← Quiz: C Arrays and Strings: all 10 questions
Quiz: C Arrays and Strings · Question 9 of 10
For int a[10];, what is the index of the last element?
For int a[10];, what is the index of the last element?
- A.10
- B.9
- C.11
- D.-1
Answer & explanation
Correct answer: 9
Indexes run from 0 to 9; a[10] is outside the array and reading it is undefined behaviour.
Can you get the rest right without peeking?
Take the timed Quiz: C Arrays and Strings quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →