Question: Question 1 (10 Marks) A binary file has filter coefficient data stored with the following format: The first four bytes contain an integer n which

 Question 1 (10 Marks) A binary file has filter coefficient data

Question 1 (10 Marks) A binary file has filter coefficient data stored with the following format: The first four bytes contain an integer n which is in stored in little endian format which represents the number of filter coefficients. The next 8n bytes contain an array of n floating point numbers stored as 8 byte double precision which represent the filter coefficients A function is required that reads the filter coefficient data stored in the file filename. The number of filter coefficients is passed back in the variable pointed to by coeff_num_p. The function allocates enough memory using malloc ) to store the filter coefficients and passes back a pointer to the filter coefficients pointed to by coeff values_p. The function returns O if it was successful in reading the file else it returns -1 Write the function described using the following prototype: extern int read_ coefficients (int coeff_num p, double +coeff_values_p[], char filename) Sample data files need to be stored in the folder where the program is run

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!