Why is strtok changing its input like this?
When strtok() finds a token, it changes the character immediately after the token into a \0, and then returns a pointer to the token. The next time you call it with a NULL argument, it starts looking after the separators that terminated the first token — i.e., after the \0, and possibly further along. Now, … Read more