‹ Back to the paper
An array is stored Row Major Wise. The address of is . If each element occupies bytes in the…
An array $Arr[3 \dots 8, -5 \dots 5]$ is stored Row Major Wise. The address of $Arr[5][-2]$ is $5120$. If each element occupies $4$ bytes in the memory, find the base address of the array.
Answer
Answer
AIRow Major Wise, number of columns per row $= 5-(-5)+1 = 11$.
Address(Arr[5][-2]) = Base + [(5-3)×11 + (-2-(-5))] × 4 = Base + (22+3)×4 = Base + 100
Given Address(Arr[5][-2]) = 5120, so:
Base address = 5120 - 100 = 5020
From ISC 2026 Improvement Computer Science Paper 1, question 2(ii).