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]

a) I, II, and IV only

b) II, III, and IV only

c) II and IV only

d) IV only

Answer (a)

I and IV are undoubtedly correct.

In II, A is an array of pointers and array style indexing can be done with pointers, it is also correct.

A[2][3] can be written as *(*(A+2)+3)


Leave a Reply

Your email address will not be published. Required fields are marked *