🎙 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 6 of 15

After this code, what is in csv? (code)

After this code, what is in csv?

char csv[] = "a,b,c";
char *t = strtok(csv, ",");
  1. A."a,b,c"
  2. B."a" — strtok wrote '\0' over the first comma
  3. C."b,c"
  4. D.An empty string
Answer & explanation

Correct answer: "a" — strtok wrote '\0' over the first comma

strtok modifies the string it splits, replacing delimiters with '\0'.

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 →