i am using gcc and i have written this code and intentionally loop is written wrong
int main() {
int a[3][3];
int i=0;
int j=0;
int num=0;
for(i=0;i<4;i++) {
for(j=0;j<4;j++) {
a[i][j]=0;
}
}
for(i=0;i<2;i++)
for(j=0;j<2;j++)
printf("%d",a[i][j]);
return 0;
}
when I do a[i][j]=0;
or a[i][j]=1;
it goes to infinite loop but when I enter other than 0 or 1 it executes correctly.
Can anybody tell me why this happens?