Question: given code to start off: #include #include #include int getInt(char *prompt); void getData(int n, int *array); void calcMeanAndStdDev(int n, int *array, double *pMean, double *pStdDev);
given code to start off:
#include
#include
#include
int getInt(char *prompt);
void getData(int n, int *array);
void calcMeanAndStdDev(int n, int *array, double *pMean, double *pStdDev);
int main(void) {
int size = getInt("Enter a positive integer for array size: ");
printf("Enter %d integers: ", size);
int *array = malloc(size * sizeof(int));
getData(size, array);
double mean, std_dev;
calcMeanAndStdDev(size, array, &mean, &std_dev);
printf("Mean is %g ", mean);
printf("Standard deviation is %g ", std_dev);
return 0;
}
// Print out the prompt, scan in an integer and return it.
int getInt(char *prompt) {
printf("%s", prompt);
int n;
scanf("%d", &n);
return n;
}
// Do not change anything above this line
//
// Scan in n (n>0) integers and store them in an array.
void getData(int n, int *array) {
// add your code here
// No [] allowed in this function
}
// Given an array of n (n>0) integers, Calculate the mean and standard deviation.
void calcMeanAndStdDev(int n, int *array, double *pMean, double *pStdDev) {
// add your code here
// No [] allowed in this function
}
(This is all the information provided. Work this out on C. You shall not use [] (array subscript notation) in the functions to be implemented. You shall not modify function signatures or the main function. I will leave upvote and positive comments if answered right!!)
. Reads in the array size Calls getData to get an array of that size Calls calcMeanAndStdDev to calculate the mean and the standard deviation Prints the mean and the standard deviation You are asked to implement the getData and calcMeanAndStdDev functions. The following is a sample execution of the program: Enter a positive integer for array size: 5 Enter 5 integers: 600 470 170 430 300 Mean is 394 Standard deviation is 147.32
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

given code to start off: