Assume the following C variable declaration: int * A [10], B [10][10];
Assume the following C variable declaration:
int * A [10], B [10][10];
Among the following expressions, which will not give compile time errors if used as left-hand side of assignment statements in a C program?
I. A[2]
II. A[2][3]
III. B[1]
IV. B[2][3]
Show answerHide answer
Correct answer: (A) I, II and IV only
Explanation
A[2] is an int pointer, A[2][3] is an int reached through it, and B[2][3] is an int, so all three can be assigned. B[1] is an array (int[10]), and an array cannot be assigned, so only I, II and IV are valid.