##### How to calculate 3-d address?

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 __________ . [Assume the first element is stored at* A*[1][1][1] and each element take 1 B]

how to calculate 3d address .

3 Dimnesional array is nothing but collection of 2 dimensional array * no of times . For example in this question : A is the collection of 20 arrays with rows 20 and columns 30. Calculate it that aspect since it is column major :

10+19*20*30+29*20+19

not getting yet :(

see.arr[3][3][3] means we have 3 tables of 2d array which comprises of 3*3 (3 rows 3 columns ) i know the method to solve address for 2 d array but in this case m not geting :(

let us consider 3-d array[i,j,k] as modified form of 2-d array[i',j'] wher i' is a 2-d array[i,k]

now, we can can now solve easily by column major order of arr[m,n,p] :

= base address + (j-1)*size of element(n,p) + (i-1)*size of element(p) + k

= 10+ (20-1)*90*40 + (20-1)*40 + 30 = 69200

for this question i assume (A[1...90,1....30,1...........40])

and applying same technique

but got 80039

I guess we can refer this as a standard based on

C(for Row-major)andFortran(for Column major)compilers-https://en.wikipedia.org/wiki/Row-_and_column-major_orderSource:"The concept generalizes to arrays with more than two dimensions.For a

d-dimensional array with dimensions N_{k }(k=1...d), a given element of this array is specified by a tuple ofd(zero-based) indices .In

, the last dimension is contiguous, so that the memory-offset of this element is given by:row-major orderIn

, the first dimension is contiguous, so that the memory-offset of this element is given by:column-major orderwhere the empty product is the multiplicative identity element, i.e.,

": https://en.wikipedia.org/wiki/Row-_and_column-major_orderReference