Question 9 ss In C Language : Annotate code, explain and show output Create a struct named Statistics that has two data members: a integer named totalSum and a double named average. Optionally, you can use a typedef to use another name for this struct. Write a function called ArrayStats() that takes two arguments, an array of integers and the size of the array. The function should return a Statistics object that contains the sum of the values in the array (stored in totalSum) and the average of the values in the array (stored in average). Call ArrayStats with two different array inputs, and print the average and sum for each array. Example Input: int intArr[] = {2, 4, 8,-9}; ArrayStats(intArr, 5); Example Output: Sum: 5 Average: 1.25
Question 9 ss
In C Language :
Annotate code, explain and show output
Create a struct named Statistics that has two data members: a integer named totalSum and a double named average. Optionally, you can use a typedef to use another name for this struct. Write a function called ArrayStats() that takes two arguments, an array of integers and the size of the array. The function should return a Statistics object that contains the sum of the values in the array (stored in totalSum) and the average of the values in the array (stored in average). Call ArrayStats with two different array inputs, and print the average and sum for each array.
Example Input: int intArr[] = {2, 4, 8,-9}; ArrayStats(intArr, 5); Example Output: Sum: 5 Average: 1.25
Step by step
Solved in 3 steps with 1 images