Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 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 : 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 ie when you compile in this step it should look something like
gcc o main main.c lm lstatistics
Ensure assigmment still operates as previously.
Step : 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 outputarray.c and outputarray.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 outputarray.c lm lstatistics
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started