This is an example of the strtok function... I need to an explanation for this block:
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ");
}
return 0;
especially 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;
}