GATE | GATE-CS-2002 | Question 33

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

filter_none

edit
close

play_arrow

link
brightness_4
code

char a[100][100];

chevron_right


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 :

(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

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


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