763 views
2 votes
2 votes
Consider a three dimensional array A[50][20][30] stored in linear array in column major order . If the base address starts at 1000, the location of A[20][10][10] is ..? (assume first element is stored at A[1][1][1])

3 Answers

0 votes
0 votes
procedure will be:

BaseAddress + traverse till A[19] (which is 3D array) then for A[20] traverse till A[20][0][9] then finally traverse A[20][9][10]
therefore the next address will be A[20][10][10]

1000 + (19*(30*20) + 9*20 + 9)*2

NOTE- In question nothing is mentioned about size of element so I've assumed it to be 2 Bytes as address is integer, which is 2 Bytes.
edited by

Related questions

0 votes
0 votes
0 answers
1
radha gogia asked Nov 26, 2018
613 views
I am getting 55-54 =1 as output but answer mentioned is 10 .
0 votes
0 votes
0 answers
2
HeadShot asked Nov 12, 2018
1,713 views
5 votes
5 votes
6 answers
3
Pankaj Joshi asked Jan 26, 2017
15,998 views
Consider 3 dimensional Array A[90] [30] [40] stored in linear array in column major order. If the base address starts at 10. The location of A[20] [20] [30] is __________...
6 votes
6 votes
0 answers
4
V pandey asked Oct 8, 2022
3,077 views
Consider a multi-dimensional array A [90][30]40] with base address start at 1000, calculate the address of A[10][20][3] in row major order and column major order. Assume ...