To find the memory location of the 13th element of an integer array when the first element is at location 2000 and each integer takes 2 bytes, use the formula:
Address of nth element=Base address+(n−1)×size of each element\text{Address of nth element}=\text{Base address}+(n-1)\times \text{size of each element}Address of nth element=Base address+(n−1)×size of each element
Here,
- Base address = 2000
- n=13n=13n=13 (for the 13th element)
- Size of each int = 2 bytes
Calculation:
2000+(13−1)×2=2000+12×2=2000+24=20242000+(13-1)\times 2=2000+12\times 2=2000+24=20242000+(13−1)×2=2000+12×2=2000+24=2024
So, the memory location of the 13th element will be 2024