1,169 views
2 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 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
Position:
Show:

Related questions

0 0 votes
0 0 answers
1.2k
1.2k views
radha gogia asked Nov 26, 2018
1,151 views
I am getting 55-54 =1 as output but answer mentioned is 10 .
0 0 votes
0 0 answers
3.0k
3.0k views
HeadShot asked Nov 12, 2018
2,971 views
7 7 votes
6 answers 6 answers
20.5k
20.5k views
Pankaj Joshi asked Jan 26, 2017
20,495 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 __________...
13 13 votes
0 0 answers
5.5k
5.5k views
V pandey asked Oct 8, 2022
5,471 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 ...