In C, 1D array of int can be defined as follows and both are correct.
But given the following definitions (along-with initialization) of 2D arrays
Pick the correct statements.
(A) Only (i) is correct.
(B) Only (i) and (ii) are correct.
(C) Only (i), (ii) and (iii) are correct.
(D) All (i), (ii), (iii) and (iv) are correct.
Explanation: First of all, C language doesn’t provide any true support for 2D array or multidimensional arrays. A 2D array is simulated via 1D array of arrays. So a 2D array of int is actually a 1D array of array of int. Another important point is that array size can be derived from its initialization but that’s applicable for first dimension only. It means that 2D array need to have an explicit size of 2nd dimension. Similarly, for a 3D array, 2nd and 3rd dimensions need to have explicit size. That’s why only (i) and (ii) are correct. But array2D and array2D are of incomplete type because their complete size can’t derived even from the initialization.
Quiz of this Question