News for hackers. Stuff that matters.
Re:Ask HN: Favorite pointer tricks in C? by deutronium on Sunday November 21, 2010 @06:24PM (#1928193)
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.

There are no comments on this comment yet.