an array P[20][50] is stored in the memory along the column with the each of the element occupying 4 bytes, find out the memory location for the element P[15][10], if P[0][0] is stored at the location 5,200.
Answers
Answer:
ok
Explanation:
please first make a brainlist
The memory location for the element P[15][10] is 6060.
Here,
Let the number of Rows, R = 20
Let the number of Columns, C = 50
The Element size, W is given to be = 4 bytes
We Know to get an array can be represented as:
P[I][J] = P[15][10]
where I = 15, J = 10
The address of P[0][0] is given to be = 5,200, which is also the base address of the array since here I = 0 and J = 0.
We know that the formula for calculating the address of an element of an array is written as:
P[I][J] = B + W[(I - LR ) + R(J - LC )]
Here, I and J are the rows and columns of the element and LR and LC are the rows and columns of the base element of the array.
Hence, the address of the element P[15][10] is:
P[15][10] = 5200 + 4[(15 – 0) + 20(10 – 0)]
= 5200 + 4[15 + 200]
= 5200 + 4 × 215
= 5200 + 860
= 6060
Learn more about Memory location:
https://brainly.in/question/6358406