🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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)?

  1. A.2
  2. B.3
  3. C.The size of a pointer
  4. 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 →