Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions