In this section, you will learn how to use strtok() function to break the string into a series of tokens. You can see in the given example, we have define a string and a pointer. The expression ch = strtok (st," ") extract the string from the string sequence one by one and printf ("%s\n", ch) prints the string after being tokenized. The expression ch = strtok (NULL, " ,") extract the whole string from the string sequence till the ch get equal to null.
Here is the code:
Output will be displayed as:
Posted on: February 6, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles