#include <stdio.h>
#include <string.h>
void print_tokens(char *str)
{
int count = 0;
char *word;
char witespace[] = " /n/r/f/t/v";
//如果stork函数的第一个参数不是NULL, 函数将找到的字符串的第一个标记。同时
//保存它在字符串中的位置
//如果strtok函数的第一个参数是NULL,函数就在同一个字符串中从这个被保存的位
//置开始向前面一样查找下一个标记
for(word = strtok(str, witespace); word != NULL; word = strtok(NULL, witespace))
{
if(strcmp(word, "the") == 0)
{
count ++;
}
}
printf("count = %d/n", count);
}
void main()
{
char arr[] = "ding the hahathe the";
print_tokens(arr);
}