As you can check this code:
#include<stdio.h>
int main(){
int a[3][4];
int i;
for(i=0;i<12;i++){
a[0][i]=12-i;
printf("a[0][%i] = %i\n", i, a[0][i]);
}
return 0;
}
It properly prints number from 12 to 1. However this piece of code:
#include<stdio.h>
int main(){
int a[3][4];
int i;
for(i=0;i<12;i++){
a[i][0]=12-i;
printf("a[%i][0] = %i\n", i, a[i][0]);
}
return 0;
}
It prints 12, 11, 10, 1, 2, 1. What may be the problem? I know you can print it by using 2 loops and variables, but I am trying to learn how to do it this way.