Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Answer ASAP. 12:39 AM Tue Feb 16 22% Achegg.com w Enter ques You will be writing two methods: int make SeparateMemory (int * numbers, int
Answer ASAP.
12:39 AM Tue Feb 16 22% Achegg.com w Enter ques You will be writing two methods: int make SeparateMemory (int * numbers, int * sizes, int count, int* memorySlices[]); and void cleanupSeparateMemory(int *memorySlices [], int count); Cor 20 We'll go through these one-by-one. [Step 1) You are to write make SeparateMemory(). We'll use the inClassTestsSimple() test case to explain it. The function is called with an array (numbers) that contains count integers, numbers(0..numbers (count-1]. The number returned is the number of slices created. For example if count is 6, numbers might contain 5, 2, -143, 43, 5, and 6. The array sizes contains an array of integers that add up to count, for example it might contain 4 and 2 (adding up to 6). Your job is to create a bunch of dynamic arrays (2 in this case, since sizes has 2 elements) of sizes sizes[0], sizes [1] etc. and fill them with the numbers in numbers. So, for example, in the case above, you might fill memory slices with two dynamic addresses (say 1024 and 2048) and if we go to those memory locations, we would find 4 ints in a row at 1024 (5, 2, -143, 43), and the other 2 would be @2048. The memory goes into the 4th parameter, memoryslices []. The number returned is the number of slices created, 2. Snap phone We'll se downl 888-888-8 By providing your ph time automated text Standard messaging [Step 2): My Textbo count (the size of the You are to write cleanupSeparateMemory. Given an array of pointers and array, basically number of pointers), clean up the memory. Solutions A hint: ABSOLUTE C++ The tests will run a small test (the one above) and a big, random test. One approach is to write your code specifically for the small test, then remove all repetition (use loops), and finally look at how you can generalize it, removing the hardcoded values for things in your parameter. by Chegg Absolute C++ 6th Edition Code has to be typed in C++, Pointers and Arrays View all solutiaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started