1.#include <stdio.h> #include <string.h> main() { static char str[] = "...ab..cd,,ef.hi"; printf("|%s|\n", strtok(str, ".")); printf("|%s|\n", strtok(NULL, ",")); printf("|%s|\n", strtok(NULL, ",.")); printf("|%s|\n", strtok(NULL, ",.")); } Running this example program produces the following results: $ RUN STRTOK_EXAMPLE1 |ab| |.cd| |ef| |hi| $ 2.#include <stdio.h> #include <string.h> main() { char *ptr, string[30]; /* The first character not in the string "-" is "A". The */ /* token ends at "C. */ strcpy(string, "ABC"); ptr = strtok(string, "-"); printf("|%s|\n", ptr); /* Returns NULL because no characters not in separator */ /* string "-" were found (i.e. only separator characters */ /* were found) */ strcpy(string, "-"); ptr = strtok(string, "-"); if (ptr == NULL) printf("ptr is NULL\n"); } Running this example program produces the following results: $ RUN STRTOK_EXAMPLE2 |abc| ptr is NULL $