← Quiz: String Handling in C: all 15 questions
Quiz: String Handling in C · Question 14 of 15
For char a[] = "hi";, what is sizeof(a)?
For char a[] = "hi";, what is sizeof(a)?
- A.2
- B.3
- C.The size of a pointer
- D.1
Answer & explanation
Correct answer: 3
The array holds 'h', 'i' and the terminating '\0'. A char pointer to "hi" would instead have the size of a pointer.
Can you get the rest right without peeking?
Take the timed Quiz: String Handling in C quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →