Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code in C please Requirements: In this lab, four functions need to be implemented using the following function prototypes: 1. float* read FloatSalaryIntoArray(FILE* fp, int*
Code in C please
Requirements: In this lab, four functions need to be implemented using the following function prototypes: 1. float* read FloatSalaryIntoArray(FILE* fp, int* totalNumOfEmployee, float* average Salary) This function reads a file pointed by a file pointer (fp), and populates a float array with its data. The first line in this file indicates how many employees there are in a company, each of the rest lines indicates the salary of an employee. This function also computes the average salary of all employees. The number of total employees and the average salary is passed back by reference. The populated float array is returned as the output of this function. 2. void find Min Max(float* arr, int size, float* minSal, float* maxsal) This function searches the minimum salary and maximum salary in this given array, and passes the values back by reference. 3. void freeArray(float** arrptr) This function frees the allocated memory and sets the array pointer back to NULL. 4. A calling function (main function) also needs to be completed, which opens the given text file, populates a float array using the first function, computes and prints the min, max, average salaries, and frees all the allocated memories. Example output: There're in total 2000 employees, the average salary is 46001.18 Largest salary is 79998.52, smallest salary is 10130.21 Grading Criteria: readFloatSalaryIntoArray function: 6 points find Min Max function: 3 points freeArray function: 3 points main function: 3 pointsStep 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