FAQ > Separate a string into tokens? (C)

There are many ways to split a line of text up into tokens. One simple example is to split up the words in a sentence. The following code shows how to do this using the strtok() function. Just beware that this function alters the original string, so if you need to use it again, make a copy before calling strtok().