The array D[-2…10][3…8] contains double type elements. If the base address is 4110, find the address of D[4][5], when the array is stored in Column Major Wise.
The given values are:
B = 4110, W = 8 bytes or 64 bits for double type , I = 4, J = 5, Lr = -2, Lc = 3,
M = (10- (-2)+1 = 10+2+1 = 13
Address of A [ I ][ J ] = B + W * [ ( I – Lr ) + M * ( J – Lc ) ]
= 4110 + 8 * [(4 – (-2)) + 13 * (5 – 3)]
= 4110 + 8 * [6 + 13*2]
= 4110 + 8 * [6+26]
= 4110 + 8 * [32]
= 4110 + 256
= 4366 (Ans)
OR = 4110 + 64 * [32]
= 4110 + 2048
= 6158 (Ans)