Suppose there is a 1-D array A[99] with
starting base address as 1100 and lower
bound is 0. Find the address of Arr[55] if the
size of each element is 3.
Answers
Answered by
1
Answer:
sheeeesh sheeeesh sheeeeeeeeeeeeeeesh
Answered by
0
Suppose there is a 1-D array A[99] with starting base address as 1100 and the lower bound is 0. Find the address of A[55] if the size of each element is 3.
The address of A[55] is 1265.
Given:
1-D array A[99] has starting base address of 1100 and the lower bound is 0 and the size of each element is 3.
To Find:
The address of A[55].
Solution:
In the case of a 1-D array, size, base address and lower bound is important.
If there is no lower bound informed, then we need to take the lower bound value as 0.
We know, the formula to get the address of a 1-D array is,
A[r] = B + n × (r - LB)
Where,
r = Subset of elements whose address is to be found
B = Base address
n = Storage size of an element
LB = Lower limit bound
And applying this formula we have,
r = 55
B = 1100
n = 3
LB = 0
Thus,
A[55] = 1100 + 3 × (55 - 0)
= 1100 + 165
= 1265
So, the address of A[55] is 1265.
#SPJ2
Similar questions