Question
In C Language : Annotate code, explain and show output Create a struct named Statistics that has two data members: a integer named totalSum and
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 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