Which of the following is equivalent to a[3] in C?
Options
- A. *(a + 3)
- B. *(a + 2)
- C. &a[3]
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. *(a + 3)
Correct Answer: *(a + 3)
In C, array indexing is based on pointer arithmetic. The expression a[i] is equivalent to *(a+i).
Therefore, a[3] means the value stored at the address obtained by moving three elements from the beginning of the array.
Notice that &a[3] gives the address of the fourth element, not its value.
Exam formula: a[i] = *(a+i)