12,077 views
0 0 votes
Consider 3 dimensional array A[90][30][40] stored in a linear array in column major order. If the base address starts at 10, what is the location of A[20][20][30]? Assume the first element us stored at A[1][1][1].

2 Answers

Best answer
3 3 votes

The location of A[20][20][30] is 94766

• selected by
0 0 votes

Base address = 10. It means address of A[1][1][1] = 10.

Dimension of 3-D array = A[90][30][40].

Note- Since elements in 3-D array are stored in column major order, So we can say that we have total 40 layers of (30*90) 2-D array.   

Assuming given array elements are integer and it takes 4 bytes of memory address. 

Location of A[20][20][30] = 10 + (19 * (90*30) + 19* 90 + 20 -1 )*4

                                     = 10 + 53029*4

                                     = 212126

• edited by
Position:
Show:

Related questions

13 13 votes
0 0 answers
5.5k
5.5k views
V pandey asked Oct 8, 2022
5,473 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 ...
0 0 votes
1 1 answer
2.2k
2.2k views
sh!va asked Jun 16, 2016
2,194 views
A two word instruction.is stored at location W. Address field of the instruction ( stored at W+1) holds value Y. If program counter value is PC, What is the effective add...
1 1 vote
1 1 answer
3.1k
3.1k views
Richa Sharma asked Jan 22, 2016
3,103 views
Represent the sentence "We are IT students" in physical memory if page size is 5 characters and the entries in page table are-061527310Assume physical memory size to be 5...
1 1 vote
3 answers 3 answers
4.3k
4.3k views
radha gogia asked Oct 18, 2015
4,264 views
If we are given PAGE SIZE=4KB, PAGE TABLE ENTRY SIZE=4B OUTER PAGE TABLE SIZE=4KB and levels of Paging=3 ,so how to go about calculating the virtual address space .