Discussion
An array A of 4 byte elements is declared with lower bound 0. What offset from the base does A[7] occupy?
Answer: B
With a lower bound of zero the offset is simply the index times the element width: \[ \text{offset} = i \times w = 7 \times 4 = 28 \ \text{bytes} \] A non-zero lower bound \( l \) would require the base to be adjusted, giving \( (i - l) \times w \) instead. Note the offset is measured from the base, so \( \mathrm{A}[7] \) is the eighth element yet sits 28 bytes along, not 32.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development