Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in cplease Objectives: Pointer arithmetic, type casting, call by reference. Requirements: In this lab, five functions need to be implemented using the following function
code in cplease
Objectives: Pointer arithmetic, type casting, call by reference. Requirements: In this lab, five functions need to be implemented using the following function prototypes: 1. void* createArray(int n, int elemSize); In this function, programmers need to creates an array with length (n+3) like below: Size of array Min value (float) Max value (float) Element 1 (arr[0]) Element n (arr[n-1]) (int) The minimum value in this array needs to be stored at the very beginning of this memory chunk as a floating-point number, followed by the maximum value in this array as another floating-point number. The size of the array is then stored after them as an integer number. These three numbers should not be visible to users. 2. int getArraySize(void * array) This function receives an array of any type, and returns the size of the array. 3. void store Min Max(void * array) This function receives an array of any type, then searches the min and max values among all elements and stores them at the corresponding locations as two floating-point numbers as described in 1. 4. void freeArray(void* array) This function receives an array of any type, then frees ALL the memories that have been allocated. 5. A calling function (main function) also needs to be completed, which creates a float array using the first function, then populates the array with any float numbers you prefer, then searches and stores the min, max values using the 3rd function. At last it prints out the desired information and frees all the allocated memories. Example output: Elements in array are: 6.20, 7.20, 8.20, 9.20, 10.20, 11.20, 12.20, 13.20, 14.20, 15.20 Array size is 10, min value is 6.20, and max value is 15.20Step 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