Question: using c statements the project is to write a suite of functions that help other developers with their everyday tasks when dealing with arrays. You
using c statements
the project is to write a suite of functions that help other developers with their everyday tasks when dealing with arrays. You will be writing functions that are geared towards int arrays, while other members in your development team will be writing function suites geared towards float and char arrays.
Your manager has decided that the following five functions would help increase developer efficiency the most:
1.Function to calculate the mean of an array of integers
2.Function to calculate the max value in an integer array
3.Function to calculate the min value in an integer array
4.Function to print the contents of an integer array in a very well formatted and easy to
read fashion
5.Function to zero out an integer array (set all elements to 0)
Your manager has helped you out and decided to name the functions for you:
1. mean_of_array
2. max_of_array
3. min_of_array
4. print_array
5. zero_array
Function Properties:
mean_of_array
This function should accept two arguments
The first argument should be an integer array
The second argument should be the length of the array
This function should calculate the mean of all of the numbers stored in the
array
This function should return the mean as a float
max_of_array
This function should accept two arguments
The first argument should be an integer array
The second argument should be the length of the array
This function should calculate the maximum value out of all the numbers
stored in the array
This function should return the max value as an int
min_of_array
This function should accept two arguments
The first argument should be an integer array
The second argument should be the length of the array
This function should calculate the minimum value out of all the numbers
stored in the array
This function should return the min value as an int
print_array
This function should accept two arguments
The first argument should be an integer array
The second argument should be the length of the array
This function should print the contents of the array in a well formatted and
easy to read fashion
This function should not return anything
zero_array
This function should accept two arguments
The first argument should be an integer array
The second argument should be the length of the array
This function should set all of the elements of the array to be 0
This function should not return anything
the manager has also helped you out by writing some of the code for testing your suite of functions.
#include/* ===== User-defined function prototypes ===== */
/* ===== Main function ===== */ int main() { /* ===== Declaration section ===== */ const int LENGTH = 7; int test_array[LENGTH]; test_array[0] = 13;
test_array[1] = 11; test_array[2] = -5; test_array[3] = 7; test_array[4] = -5; test_array[5] = 8; test_array[6] = -1; float mean_result = 0.0; int max_result = 0;
int min_result = 0;
/* ===== Execution section ===== */
/* Code to test function 1 */
/* Code to test function 2 */
/* Code to test function 3 */
/* Code to test function 4 */
/* Code to test function 5 */
return 0; }
/* ===== User-defined function definitions ===== */
the job is to write the five functions (prototypes and definitions), and then write code in the main function that tests your user-defined functions by calling them and printing the result if necessary. A test array has been declared and initialized with values for you to use when testing your functions. Three other variables have been declared that should be used to store the return value of functions 1-3.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
