C Quiz – 102 | Question 5
In the context of the below program snippet, pick the best answer.
Which of the given printf statement(s) would be able to print arr
(A) only (i) would compile and print 123.
(B) both (i) and (ii) would compile and both would print 123.
(C) only (i), (ii) and (iii) would compile but only (i) and (ii) would print 123.
(D) only (i), (ii) and (iii) would compile and all three would print 123.
(E) all (i), (ii), (iii) and (iv) would compile but only (i) and (ii) would print 123.
all (i), (ii), (iii) and (iv) would compile and all would print 123.
Explanation: For arrays, we can convert array subscript operator  to pointer deference operator * with proper offset. It means that arr[x] is equal to *(arr+x). Basically, these two are interchangeable. The same concept can be applied in multi-dimensional arrays as well.
That’s why all of the above 4 printf are referring to the same element i.e. arr
Quiz of this Question