Prashnikaप्रश्निका
Code
About
‹ Back to the paper
Computer Science20172 marksNumericalArrays, StringsTool: 2D array visualiser

Answer the following question.

A matrix P[15][10] is stored with each element requiring 8 bytes of storage. If the base address at…

A matrix $P[15][10]$ is stored with each element requiring 8 bytes of storage. If the base address at $P[0][0]$ is 1400, determine the address at $P[10][7]$ when the matrix is stored in Row Major Wise.

Answer

Answer

Row Major: $Address(P[i][j]) = B + W[(i - L_r) \times N + (j - L_c)]$, with $B = 1400$, $W = 8$ bytes, $N = 10$ columns, $L_r = L_c = 0$. $Address(P[10][7]) = 1400 + 8[(10 - 0) \times 10 + (7 - 0)]$ $= 1400 + 8 \times 107 = 1400 + 856$

Final answer: 2256