I was recently working on 2-D arrays in C. My code looks something like this -
#include<stdio.h>
void main()
{
int A[3][3];
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&A[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d ",A[i][j]);
printf("\n");
}
}
The input I gave was -
2 1 3
1 3 2
1 2 3
But I don't know why the C(GCC 6.3) compiler tends to throw a run-time error. The code seems to work fine and matrix A shows everything perfectly while display.