← Quiz: String Handling in C: all 15 questions
Quiz: String Handling in C · Question 4 of 15
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
char a[] = "exam";
printf("%d", (int)sizeof(a));
return 0;
}
- A.4
- B.5
- C.8
- D.2
Answer & explanation
Correct answer: 5
The array holds 4 letters plus '\0', so sizeof is 5.
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 →