i need to create a function to the program i've written which takes the two-dimensional array and returns an array "r" (of length 4) and "c" (of length 3). This function should computer the average values of each row and column, then return r and c to main program. both array need to be double precision. Here is the code of the main function, it just created a two-dimensional array of size 4x3 and is initialized to the sum of x, the row, and column values:
Code:
# include <stdio.h>
void mavg(int m[][3]);
int main(void)
{
int x;
int i, j;
int m[4][3];
/* Part 1 */
printf("Enter an integer x: ");
scanf("%d", &x);
/* Part 2 */
for(i=0; i<4; i++){
for(j=0; j<3; j++){
m[i][j] = i+j+x;
printf(" %d", m[i][j]);
}
printf("\n");
}
mavg(m);
return 0;
}
void mavg(int m[][3])
{
int r[4];
int c[3];
int sum, row, x, y, avg;
sum = 0;
row = 0;
}