Consider an array a[20,10]. assume 4 words per memory cell and the base address of array a is 100. find the address of a[11,5] assuming row major storage
Answers
Answered by
18
0,0)---------(0,9)-----(10,0)-------(10,9)(11,0),---(11,4),.
Base address is 100.Address of (11,5)= 100+110x4+20=560.
Base address is 100.Address of (11,5)= 100+110x4+20=560.
Answered by
14
Answer:
560
Explanation:
Each cell needs 4 words
A[0][0], A[0] [1],.....A[0][9] needs 4x10 =40 words.
Since array starts at 100, A[0][9] will be at 100+40=140 th location.
Similarly, from A[0][0] to A[10][9] there are 11x10=110 elements.
From A[11][0] to A[11][5]there are 5 elements.
Total 115 elements are present before A[11][5].
Hence A[11][5] will be at 100+ 4x115 = 560
Similar questions