C | Arrays | Question 7

Consider the following declaration of a ‘two-dimensional array in C:

 char a[100][100]; 

Assuming that the main memory is byte-addressable and that the array is stored starting from memory address 0, the address of a[40][50] is (GATE CS 2002)

(A) 4040
(B) 4050
(C) 5040
(D) 5050


Answer: (B)

Explanation:

Address of a[40][50] = Base address + 40*100*element_size + 50*element_size
                      = 0 + 4000*1 + 50*1
                     = 4050


Quiz of this Question




Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:



2.5 Average Difficulty : 2.5/5.0
Based on 2 vote(s)