Suppose I have a character string "the pe(o)ple."
And use a char array of delimiters; char delimiters[]="()"
Why does strtok return "the pe" and not the "the people"
The strtok function is not just meant to remove characters from a string. It is more for when you want to extract substrings that are separated by some character (e.g. names separated by commas).
Passing the string to strtok will return the substring up to the first delimiter character. Calling strtok again, but passing NULL instead of passing the string, you get the next substring. Normally strtok is used in a loop.
That says that the first call to strtok replaces the '(' with null and returns a pointer to 't'.
Therefore, the array contains the the pe\0o)ple.\0.
The second call (with NULL parameter) replaces the ')' with null and thus shows "o".
The third call (with NULL parameter) shows "ple.".
All subsequent calls will return NULL.