C variable decleration on gcc compiler - compile time error.

Posted by liv2hak on Stack Overflow See other posts from Stack Overflow or by liv2hak
Published on 2011-01-16T00:46:42Z Indexed on 2011/01/16 0:53 UTC
Read the original article Hit count: 197

Filed under:

Assume the following C variable decleration

int *A[10] , B[10][10];

Of the following expressions

  1. A[2]
  2. A[2][3]
  3. B[1]
  4. B[2][3]

which will not give compile time errors if used as left hand sides of assignment statements in a C program.

A) 1,2 and 4 only
B) 2,3, and 4 only
C) 2 and 4 only
D) 4 only

I have tried this on a gcc compiler.I assigned the value '0' to all the above variables.Only the third one showed an error.I can't really understand the reason.Can someone please expalin why that is.?

Thanks

© Stack Overflow or respective owner

Related posts about c