i have a problem involving arrays in functions. i don't know how to declare functions with 2-dimensional arrays as its parameter and return the values of the 2-dimensional arrays.
here is my code:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int mat_A[50][50], mat_B[50][50];
int disp_mat(int mat_A[50][50], int mat_B[50][50]);
main()
{
/*main function - asks for contents of mat_A and mat_B from user*/
}
int disp_mat(int mat_A[50][50], int mat_B[50][50])
{
printf("Matrix A: \n");
printf("Number of rows: %d \n", r1);
printf("Number of columns: %d \n", c1);
for(i=0;i<r1;i++){
for(j=0;j<c1;j++)
printf("|%d|", mat_A[i][j]);
printf("\n"); }
printf("Matrix B:");
printf("Number of rows: %d \n", r2);
printf("Number of columns: %d \n", c2);
for(i=0;i<r2;i++){
for(j=0;j<c2;j++)
printf("|%d|", mat_B[i][j]);
printf("\n"); }
return(mat_A[50][50], mat_B[50][50]);
}
i know its wrong. please help me figure out how to work with functions involving 2 dimensional arrays.
thanks!