(ii)
An array ARR[ −4 …..6, −2…..12] , stores elements in Row Major Wise, with the
address ARR[2][3] as 4142. If each element requires 2 bytes of storage, find the
Base address.
Solution
Row- wise order,
AR[2][3] = B + W(N(i-1)+(j-1))
Given i = 2, j = 3, W = 2 bytes B = ? N = Uc – Lc + 1 = 12 – (-2) + 1 = 12 + 2 + 1 = 15
Now, 4142 = B + 2 [15 (2 -(-2)) + (3-(-4))]
4142 = B + 2[60 + 7]
B = 4008