Comment on Ask HN: Favorite pointer tricks in C?parentComments−deutronium15yThis 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.
Comments
This is how strtok returns tokens too.
Incidentally I only found this after trying:
And getting a segfault, as 'tmp' is not writeable memory.