Question: In C please. Provided starter code. just need to write a program to take an integer array, an integer representing the size of the array,

In C please. Provided starter code. just need to write a program to take an integer array, an integer representing the size of the array, and a result pointer. This function will calculate the average of all the elements in the array which are odd, and place the result in the result pointer. The function will return 0 on error, or the number of elements averaged on success. using avgOdd In C please. Provided starter code. just need to write a program

to take an integer array, an integer representing the size of the

In this lab, you will cover pass by reference and error codes. You must analyze the problem given, determine what error conditions you may encounter, and make sure you code will not crash if an error condition is encountered. Test data is provided that you may optionally use. The first line in the data file is an integer representing the number of entries in the file, and the following lines are integers between 0 and 100. 1.1 avgOdd int avgOda(int *array, int size, tloat result); Info: This function will take an integer array, an integer representing the size of the array, and a result pointer. This function will calculate the average of all the elements in the array which are odd, and place the result in the result pointer. The function will return 0 on error, or the number of elements averaged on success. #include "lab1.h" int main() { FILE *file = fopen("numbers.txt", "r"); if(!file) { // Unable to open the specified file return EXIT_FAILURE; } int size; if(fscanf(file, "%d", &size) != 1) { fclose(file); 17 Unable to read the array size from the file return EXIT_FAILURE; 3 int array[size]; for(int i 0; i

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!