I have the following homework question:
Consider the following declarations and answer the question.
char strarr1[10][32];
char *strarr2[10];
Are strarr1[3][4] and strarr2[3][4] both legal references?
I tried compiling the code with gcc to test it. I was fairly sure that the second reference would throw an error, but it didn't. This is what I compiled with gcc:
int main(void){
char strarr1[10][32];
char *strarr2[10];
char x = strarr1[3][4];
char y = strarr2[3][4];
return 0;
}
I'm working under the assumption that the test code I used is correct.
How is it possible to reference strarr2[3][4] when strarr2 is a single-dimensional array?