# Thread: 2d array problem function receiving

1. ## 2d array problem function receiving

Code:
```#include <stdio.h>
#define N 3
/**/
int setMatrix(int arr[][N]);
int checkMatrix(int arr[][N]);
/*******************************************************************************/
int main()
{
int matrix[N][N];
setMatrix(matrix);
puts("Checking now\n");
checkMatrix(matrix);

}
/***********************/
int setMatrix(int arr[][N])
{
int mtx[N][N];
int i, j;
puts("Printf please fill up the matrix\n");
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
{
puts("Enter number \n");
scanf("%d", &mtx[i][j]);
}

return 0;
}
/*********************************/
int checkMatrix(int arr[][N])
{
int i, j;
int data[N];
int max; // For maximum algoritm
/******************************************/
for (i = 0; i < N; i++)
{
max = arr[i][0];
for (j = 0; j < N; j++)
{
if (arr[i][j]>max)
max = arr[i][j];
}
data[i] = max;
}
/******************************************/
printf(" Data %d %d %d \n", data[0], data[1], data[2]);
return 0;
}```
Need help please problem with receiving 2d arrays in functions I receive some sort of memory trash not a numbers what was implemented help please and thank you.

2. > int mtx[N][N];
Delete this

> scanf("%d", &mtx[i][j]);
Change this to use arr instead.

3. Originally Posted by Salem
> int mtx[N][N];
Delete this

> scanf("%d", &mtx[i][j]);
Change this to use arr instead.
Thank you.
Inshallah, shukran.