-4
这是的strtok函数的例子...我需要一个解释用于该块:的strtok函数c解释
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ");
}
return 0;
尤其pch = strtok (NULL, " ");
#include <stdio.h>
#include <string.h>
int main()
{
char str[] ="This a sample string";
char * pch;
printf ("Splitting string \"%s\" into tokens:\n",str);
pch = strtok (str," ");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ");
}
return 0;
}
你看过[函数文档](http://en.cppreference.com/w/c/string/byte/strtok)吗? –
这是[strtok的在线手册页](http://linux.die.net/man/3/strtok)。阅读完后你有什么特别的问题吗? –
我知道这个函数从字符串中获取标记,但是在这一行[strtok(NULL,“”); ]我不知道我将得到它的令牌的字符串在哪里! –