Question: Make a simple program that contains a main.c file and create multiple functions that takes an array of arbitrary length of numbers and adds them,

Make a simple program that contains a main.c file and create multiple functions that takes an array of arbitrary length of numbers and adds them, calculates the average, and finds the standard deviation. Use 3 different arrays (size and values) to calculate the average, standard deviation, and sum.
./main
the average is: x
the std is: x
the sum is: x
We will be creating a library from our lab assignment 1. Follow the notes in the lecture to convert your math functions, sum, standard deviation, and average to a custom library that will be linked in the linkage stage. We will also be adding a custom structure data type and a custom print function for the array. Detailed instructions are below.
Step 1: Library creation
Create two files: statistics.h and statistics.c. Statistics.h file will contain the funcion declarations. Stastics.c will contain the function implementation. Create a library of these two files that can be linked to, i.e. when you compile in this step it should look something like
gcc -o main main.c -lm -lstatistics
Ensure assigmment 1 still operates as previously.
Step 2: New functionality
Add the functions to your new statistics library to find the maximum and minimum of a given input array. Finally, find the absolute value of the difference between the maximum and minimum.
Next, create an output_array.c and output_array.h that defines a function which takes the array and size as an input argument and outputs the array. Output the array to the screen using the new function in main.c. Compilation should look like this:
gcc -o main main.c output_array.c -lm -lstatistics

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!