Which formula represents the address of the element A[i] in a zero-based one-dimensional array?
Options
- A. Base + i * w
- B. Base + (i - 1) * w
- C. Base + i + w
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. Base + i * w
Correct Answer: A. Base + i * w
Explanation: For a zero-based array, the address of A[i] is calculated as:
Address(A[i]) = Base Address + (i * w)
Example: If Base = 1000, i = 3 and w = 4, address = 1012.