6. If an array b[11][8] is stored as column wise and b[2][2] is stored at 1024 and b[3][3] at 1084. Find out the base address, size of an element and address of b[5][3].
Answers
Answered by
7
Answer:
964
Step-by-step explanation:
Address of b[1][1] = 964
Explanation:
For B[2][2], B = ?
I = 2
J = 2
R₀ = 0
C₀=0
Number of rows(M)=11
Address of element Arr[I][J]=B+W[(I-R₀)+(J-C₀)]
So, Address of element B[2][2]= B+W[(2-0)+11(2-0)]
or, 1024=B+W[2+11(2)]
1024=B+W[2+22]
1024=B+W[24]
1024=B+24W. -(i)
And,
1084=B+W[(3-0)+11(3-0)]
1084=B+W[3+11(3)]
1084=B+W[3+33]
1084=B+W[36]
1084=B+36W. -(ii)
Now, on subtracting equation(i) from equation(ii), we get
1084=B+36W
1024=B+24W
- - -
60=12W
_____________
So, W
=60/12
therefore, W=5
So, B=1024-24W
B=1024-24(5)
=1024-120
=904
now ,b[1][1]= 904+5[(1-0)+11(1-0)]
=904+5[1+11]
=904+5[12]
=904+60
=964
Similar questions