1) The array index start from 0, as per your code it will access matrice[2][2]
which will cause undefined behavior.
2) matrice[a][b]=scanf("%d",&i);
will store the return value of scanf
in matrice[a][b]
.
#include <stdio.h>
int main() {
int a,b,matrice[2][2];
printf("Put inside the matrix some numbers..\n");
for (a=1;a>=0;a--)
{
for (b=1;b>=0;b--)
{
scanf("%d",&matrice[a][b]);
}
}
//Then print or do other operations on matrice
return 0;
}
1
solved Weird behavior of a counter inside the for loop