C String Tokenizer
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:
TOKENIZE.C
#include <stdio.h>
|
Output will be displayed as:
TOKENIZE.EXE