Assume the following C variable declaration: int *A[10], B[10][10]; Among the…
2018
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 the left-hand side of assignment statements in a C program? I. A[2] II. A[2][3] III. B[1] IV. B[2][3]
- A.
I, II and IV only
- B.
II, III and IV only
- C.
II and IV only
- D.
IV only
Attempted by 182 students.
Show answer & explanation
Correct answer: A
A[2] — type: int* (element of the array of pointers). This is an lvalue and can be assigned (for example: A[2] = ptr;).