Question: The incomes array is created in main() and contains the (double) incomes of all the households that were surveyed. A SIZE constant has also been
The incomes array is created in main() and contains the (double) incomes of all the households that were surveyed. A SIZE constant has also been defined before main() containing the number of households surveyed. Write the C code segments (not an entire program) that perform each of the tasks described below:
a. write the code for the entire C function that can be called from main() to calculate and return to main() the average income of all the households. Pointers and pointer arithmetic MUST BE USED WHEREVER POSSIBLE in the code, including returning the average to the main() function.
b. write ONLY the statements in main() that call the function in part a., and then outputs the statement below, formatted as shown. USE POINTER VARIABLES IN main() ONLY IF NEEDED. MARKS WILL BE LOST FOR USING POINTERS IF NOT NEEDED.
The average household income was $47819.55.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
