2 ms·
This is how strtok returns tokens too. Incidentally I only found this after trying: char tmp[] = "cat,mat,sat"; char *t; t = strtok(tmp,",");
by deutronium 16y ago
This is how strtok returns tokens too.
Incidentally I only found this after trying:
char tmp[] = "cat,mat,sat";
char *t;
t = strtok(tmp,",");
while(t != NULL){
printf("%s\n",t);
t = strtok(NULL,",");
}
And getting a segfault, as 'tmp' is not writeable memory.