1. ## 2-D Arrays (Matrices)

I'm confused

I have to creat 2 matrices and then produce a third matrxi. But here is the problem that i have:

Question states "third matrix whose all off diagonal entries are zero and the diagonal entries are the sum of first 2 matrices."

Off diagonal? diagonal? I dotn get that

1 3 5
5 6 7
7 9 9

would diagonal be 1,6 and 9? and the rest off diagonal?

and then i'm not really sure how to add them...so far i have:

Code:
```void get_mat(int mat[][3]);
void get_mat2(int matx[][3]);
void add_mat(int mat1[][3], int mat2[][3], int mat3[][3]);
void ptr_mat(int mat[][3]);

main()
{

int matrix[3][3];
int matrix1[3][3];
int matrix2[3][3];

get_mat(matrix);
get_mat2(matrix1);

ptr_mat(matrix2);

}

void get_mat(int mat[][3])
{
int i, j;

for(i=0; i<3; i++){
for(j=0; j<3; j==){
printf("Please enter Matrix 1 [%d][%d]", i,j)'
scamf("%d", &mat[i][j]);
}
}
}

void get_mat(int mat2[][3])
{
int i, j;

for(i=0; i<3; i++){
for(j=0; j<3; j==){
printf("Please enter Matrix 1 [%d][%d]", i,j)'
scamf("%d", &mat2[i][j]);
}
}
}```

thanks

2. > would diagonal be 1,6 and 9? and the rest off diagonal?
Seems about right to me, from what I can remember.

This indexes the diagonal
for ( i = 0 ; i < n ; i++ ) mat[i][i] = 0;

3. never mind...got it working