Question: Make a function that sorts an array of doubles and returns the average and the median values from the array. NOTE: Pass by reference is

Make a function that sorts an array of doubles and returns the average and the median values from the array. NOTE: Pass by reference is REQUIRED for full credit.
Details
Begin by using the following array of data within your main function:
Next, create a separate function that has the following parameters:
Input: An array of doubles and the size of the array (integer)
Output: The average (double) and median (double) of the array. Use the C version of pass by reference for the output.
Inside this new function perform the following steps:
Calculate the average
Use a for loop to find the sum and divide by the size of the array
Sort the array using either Bubble sort or Selection sort
This will involve creating nested for loops AFTER you have calculated the averagesort
This will involve creating nested for loops AFTER you have calculated the average
Don't try to both sort and calculate the average in the same loops
Calculate the median
The median is the middle value in a sorted array.
Set the average and median pointers to the values you calculated
Back in your main function call this new function. It should take four parameters, the array, the size of the array, a pointer to an average variable and a pointer to a median variable.
Print the average and median back in the main function. Do NOT print the results in the function that did the calculation. printf should only be in your main function.
Results
If you code works you will see the following results. Note that you will not receive full credit for outputting the same numbers, but for utilizing pass by reference.
Average: 329.79 Median: 128.20
 Make a function that sorts an array of doubles and returns

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!