Question 10
Back to Exercise
Which statement about strtok() is true?
- A It never changes the input
- B It writes '\0' over delimiters in the input and keeps internal state between calls, so it cannot be used on string literals Correct
- C It returns a newly allocated copy of each token
- D It returns empty tokens between adjacent delimiters
Correct Answer: Option B
Pass a writable array on the first call and NULL on later calls. Adjacent delimiters are skipped, so "a,,b" gives two tokens.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!