Question: 4 . 2 Main Function int main ( int argc, char * * argv ) ; Arguments: This function have should have the two defined
Main Function int mainint argc, char argv; Arguments: This function have should have the two defined arguments above. Output: This function should have no output. Return: A simple integer. Just Disclaimer: The program will be passing in a single file name as an argument. D Array Creation Context: Similar to lab you will be writing a function that generates a list of integers initialized to s createOneDimensionalArray; Arguments: This function will have one argument. size: an integer representing the length of the new array Output: This function will output one line. The size of the array that was created. Array of size # is created. where # is the size of the array. Return: A pointer to the newly created array. Matrix Creation For this function, you are expected to create a matrix. A matrix is a D array of integers. All values will be initialized to Details regarding this matrix will come from the file. createMatrix; Arguments: This function will have two arguments. columns: an integer representing the number of columns rows: an integer representing the number of rows Output: This function will output two lines: the size and the list of values. Matrix of size X Y is created. where X is the number of rows and Y is the number of columns. Return: A pointer to the newly created matrix. Disclaimer: DRY must be applied here. Read File Containing Matrix Data For this function, you are expected to read in a file that contains information on two matrices. readFile; Arguments: This function will have one argument. fileName: a char pointer representing the name of the file Output: This function will output the following line, two times. Matrix of size X Y is found. where X is the number of rows and Y is the number of columns. Since the file has two matrices inside of it you are expected to print the dimensions of the arrays that were found. Return: A rating between and representing the difficulty of this function Reminder: Please refer to the example input above on the structure of the text file. Matrix Addition For this function, you are expected to add two matrices together. The first matrix will be a new initialized matrix from the function above and the second will be read from a file. You cannot assume the matrices will be of the same size. addMatrices; Arguments: This function will have four arguments. defaultMatrix: an int double pointer representing the default matrix readInMatrix: an int double pointer representing matrix from the file rows: an integer representing the number of rows cols: an integer representing the number of columns Output: This function will output the result of the addition, when possible. # # # where there will be X number of rows and Y number of columns. Return: an int double pointer representing the summed matrix Error: If not the same size, you must print the following line: Matrices are not the same size. Cannot add. Diagonal Sum of Matrix For this function, you are expected to get the main diagonal sum of the passed in matrix. The main diagonal is the diagonal that starts from the top left corner and goes to the bottom right corner. You cannot assume the matrix will be square. The definition of a square matrix is that the number of rows is equal to the number of columns. computeDiagonalSum; Arguments: This function will have three arguments. matrix: an integer double pointer representing the matrix rows: an integer representing the number of rows cols: an integer representing the number of columns Output: This function will output sum of the main diagonal, when possible. Diagonal Sum is: X where X is the sum of the main diagonal. Return: A rating between and representing the difficulty of this function First Error: If not a square, you must print the following line: Matrix is not square. Cannot compute diagonal sum. Second Error: If add matrices failed, you must print the following line: Matrices were not able to be added together. Disclaimer: The matrix used for this function will be the result of addMatrices EXTRA CREDIT: Tracking Memory For this function, you are expected a twofold mission: Print the number of bytes the matrix from addMatrices contains. Ensure you have freed all memory correctly. No points will be given if you printed the bytes but did not free accordingly. collectBytes; Arguments: This function will have three arguments. matrix: an integer double pointer representing the matrix rows: an integer representing the number of rows cols: an integer representing the number of columns Output: This function will output the number of bytes the matrix is Total bytes of matrix: X where X is the sum of all bytes in the matrix. Return: A rating between and representing the difficulty of this function Disclaimer: The matrix used for this function will be the result of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
