Hi I have these arrays in a driver to use for testing:
insertIf I want to test these functions in this header:Code:#include <stdlib.h> #include <stdio.h> #include "TwoD.h" int main() { /* Initialization of LCV's */ int i,j, colsum; TwoD td; /* Initialization of A and B matrices */ int A[5][5] = { { 3, 7, 3, 6, 9 }, { 2, 0, 3, 0, 2 }, { 1, 7, 2, 2, 7 }, { 9, 2, 9, 3, 1 }, { 9, 1, 4, 8, 5 } }; int B[5][5] = { { 6, 5, 5, 2, 1 }, { 7, 9, 6, 6, 6 }, { 8, 9, 0, 3, 5 }, { 2, 8, 7, 6, 2 }, { 3, 9, 7, 4, 0 } }; /* Displaying A's Values */ printf("A's Values:\n"); for(i = 0; i < 5; i++) { for(j = 0; j < 5; j++) { printf("%d ", A[i][j]); } printf("\n"); } printf("\n\n"); /* Displaying B's Values */ printf("B's Values:\n"); for(i = 0; i < 5; i++) { for(j = 0; j < 5; j++) { printf("%d ", B[i][j]); } printf("\n"); } }
insertI am trying to perform columnSum and rowSum, as well as twoDadd and twoDSubtract using the arrays defined in my driver. How would I do that using A and B in my driver? Thanks!Code:#ifndef TWOD_H_INCLUDED #define TWOD_H_INCLUDED #define MAX_SIZE 50 /* Structure defenition for TwoD */ typedef struct { int rows, cols; int element[MAX_SIZE][MAX_SIZE]; }TwoD; /* Computes the sum of values in each column of the matrix, storing each value in the integer array */ void columnSum(TwoD, int [], int); /* Computes the sum of values in each row of the matrix, storing each value in the integer array */ void rowSum(TwoD, int [], int); /* Returns the sum of two matrices */ TwoD twoDAdd(TwoD, TwoD); /* Returns the difference of two matrices */ TwoD twoDSubtract(TwoD, TwoD); #endif