Question 7
Back to Exercise
For an array a and an int i, what is i[a]?
- A A compile error
- B The same element as a[i] Correct
- C The address of a[i]
- D Undefined behaviour
Correct Answer: Option B
The standard defines E1[E2] as *((E1) + (E2)). Addition is commutative, so i[a] is *(i + a), exactly a[i]. Legal, but never write it in real code.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!