← Quiz: C Arrays and Strings: all 10 questions
Quiz: C Arrays and Strings · Question 2 of 10
What are the values of int a[5] = {1, 2};?
What are the values of int a[5] = {1, 2};?
- A.1, 2, garbage, garbage, garbage
- B.1, 2, 0, 0, 0
- C.1, 2, 1, 2, 1
- D.Compile error
Answer & explanation
Correct answer: 1, 2, 0, 0, 0
Missing initial values in an array initialiser become 0.
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 →