#include <stdio.h>
#include <string.h>
/*strtok 查找由指定的分界符分隔开的单词*/
int main(int argc,const char *argv[])
{
char ch[] = "hello i am a good man";
char *temp = strtok(ch, " ");
while (*temp != '\0')
{
printf("%s ", temp);
temp = strtok(NULL, " ");
}
}
输出结果:
hello i am a good man
字符串操作--strtok 查找由指定的分界符分隔开的单词
最新推荐文章于 2021-05-18 10:10:07 发布