p = strtok(NULL, ","); 看不懂,请高手来帮忙一下!
#include <string.h>
#include <stdio.h>
int main(void)
{
char input[22] = "abc,d,eee,fff,ggg,hhh";
char *p;
/* strtok places a NULL terminator
in front of the token, if found */
p = strtok(input, ",");
if (p) printf("%s\n", p); //abc
/* A second call to strtok using a NULL
as the first parameter returns a pointer
to the character following the token */
p = strtok(NULL, ",");
if (p) printf("%s\n", p); //d
//这里不知道它在做什么,看不懂,尤其是p = strtok(NULL, ","); 中的null,
请帮忙解释一下。
return 0;
}
谢谢!