Question
Language: C99 Use array pointer notation struct statistics { int min; int max; int sum; }; Write the following functions: void stats(const int *a, int
Language: C99
Use array pointer notation
struct statistics { int min; int max; int sum; };
Write the following functions:
void stats(const int *a, int len, struct statistics *s) which mutates the fields of the struct statistics (see the starter file) so that the maximum, minimum and sum fields are the maximum, minimum and sum of the array elements in a respectively.
double mean(const int a[], int len) which returns the mean of the elements of the array.
double var(const int a[], int len) which returns the variance of the elements of the array.
int median(int a[], int len) which returns the median element of the array. Recall that the median of a list of numbers is the middle most element when the list is sorted. If there are an even number of elements, take the average of the middle two elements and round towards zero (ie. use integer division). Hint: You will need to mutate the array.
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