Machine-translated by Google. Questions are authored in English.
Top

Discussion

An array A of 4 byte elements is declared with lower bound 0. What offset from the base does A[7] occupy?

  • A.24
  • B.28
  • C.7
  • D.32

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.