7,670 views
0 votes
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 votes
3 votes

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

selected by
0 votes
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

Related questions

6 votes
6 votes
0 answers
1
V pandey asked Oct 8, 2022
3,059 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 votes
0 votes
1 answer
2
sh!va asked Jun 16, 2016
1,742 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 votes
1 votes
1 answer
3
Richa Sharma asked Jan 22, 2016
2,636 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 votes
1 votes
3 answers
4
radha gogia asked Oct 18, 2015
3,466 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 .