-
Assume the following C variable declaration
int* A [10], B [10] [10];
Of the following expressions which will not give compile time errors if used as left hand sides of assignment statements in a C program ?
(i) A [2]
(ii) A [2] [3]
(iii) B [1]
(iv) B [2] [3]
-
- I, II and IV only
- II, III and IV only
- II, and IV only
- IV only
- I, II and IV only
Correct Option: A
A is an array of pointers to int, and B is a 2D array
* A [2] = Can take a pointer
* A [2] [3] = Can take an Int
* B [1] = It is the base address of array and it cannot be changed, as array in C is a Constant pointer. We can not make B the point some other array. So this is false.
* B[2][3] = It can take an integer.
So, option (a) is correct.