← 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, ",");
- A."a,b,c"
- B."a" — strtok wrote '\0' over the first comma
- C."b,c"
- 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 →