Question: In C please, thank you! Exercise dynamic memory allocation 1.) Consider you want to dynamically allocate memory for an array of arrays, where each array

 In C please, thank you! Exercise dynamic memory allocation 1.) Consider
In C please, thank you!

Exercise dynamic memory allocation 1.) Consider you want to dynamically allocate memory for an array of arrays, where each array has variable length. The type of the arrays would be float. Write a function that takes two items: i) an integer P that represents number of arrays, and ii) An array called Lengths of size P that contains Lengths for P number of arrays. After allocating memory for the arrays, the function should fill-up the arrays with random numbers from 1 to 100 (you can put an int to a float variable. The integer will get promoted to float automatically). At the end the function retums appropriate pointer. Next write a set of statements to show how you would free-up the memory. In the blank bellow, write the appropriate return type. AllocateArrayOfArrays( int P, int *Lengths) { b) Write few C statements to declare an appropriate variable and call the AllocateArrayOfArrays() with example parameters. Later on write necessary C statement(s) to free the allocated memory

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!