I have the following code in C
int main(int argc, char *argv[]) {
int row=2, col=3, f,c;
char array[row][col] = { {'A', 'B', 'C'}, {'a', 'b', 'c'} };
for(f=0; f<row; f++) {
for(c=0; c<col; c++)
printf("%c", a[f][c]);
printf("\n");
}
return 0;
}
Why does this line NOT work like this:
char array[row][col] = { {'A', 'B', 'C'}, {'a', 'b', 'c'} };
error: excess elements in array initializer
But why does it DO work like this?
char array[2][3] = { {'A', 'B', 'C'}, {'a', 'b', 'c'} };
Errors(0) Warnings(0)