1
0

strrtok.c 464 B

123456789101112131415161718192021
  1. //
  2. // strrtok.c
  3. #include <stdio.h>
  4. #include <string.h>
  5. int main(void)
  6. {
  7. char data[] = " C is\t too#much\nfun!";
  8. const char tokseps[] = " \t\n#"; /* separators */
  9. char * pt;
  10. puts(data);
  11. pt = strtok(data,tokseps); /* intial call */
  12. while (pt) /* quit on NULL */
  13. {
  14. puts (pt); /* show token */
  15. pt = strtok(NULL, tokseps); /* next token */
  16. }
  17. return 0;
  18. }