code is in c. 5 functions
CS 100 Lab Eight - Spring 2018 Create a directory called lab8. Within this directory, complete the program, shown below, named lab8 . C. You can download this file from Blackboard. Write the five functions shown in red. #include include
up int **allocateMatrix (int, int) void initMatrix (int**int, int) int findRange (int**, int, int); double findAverage (int**, int, int) void printCorners (int *int, int) int main(int arge, char *argv) int **data int row atoi (argv [1]) int col = atoi (argv [2]); up dataallocateMatrix (row, col) initMatrix (data, row, col): printf ("The range of values is %d ", findRange (data, row, col) ); printf ("The ave rage of all values is fin", findAverage (data, row, col) ); printCorners (data, row, col); return 0 dn A sample execution of this program is shown below /a.out 2 2 The range of values in the array is 532 The average of all array values is 740.250000 383 886 777 915 del A brief description of each of the five functions you have to write is given below: allocateMatrix - Takes the number of rows and columns. Allocates space for the matrix, retu rning a pointer to that location in memory. Recall that to allocate space for the matrix, you: o Declare an int * variable (which you will retum to the calling program) Allocate space to point to all the "rows" in the matrix ("row" pointers) o For each row in the matrix, allocate space for all integers on that row ("column" integers) initMat in the matrix to a random value in range of 0-999. Make sure to seed your ra using srand (0) ; at the start of your function. trix Takes a pointer to the array and the number of rows and columns. Initialize all values ndom number generator e -Takes a pointer to the array and the number of rows and columns. Calculates the largest and returns the range of the elements in the matrix. Recall the range of an matrix is value minus the smallest value in the matrix. findAverage -Takes a pointer to the array and the number of rows and col returns the average value (a double) of all elements in the matrix Takes a pointer to the array and the number of rows and columns. Prints the fou values at the corners of the matrix Submit vour lab First, on your local machine, compress your lab8 directory into a single (compressed) file Second, once you have a compressed file that contains your lab8 program, submit that file to Blackboard