Answered step by step
Verified Expert Solution
Link Copied!

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 cpleaseimage text in transcribed

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.20

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

recognise typical interviewer errors and explain how to avoid them

Answered: 1 week ago

Question

identify and evaluate a range of recruitment and selection methods

Answered: 1 week ago

Question

understand the role of competencies and a competency framework

Answered: 1 week ago