Listing 4 token1.c — extracts tokens by ignoring space and punctuation characters

/* token1.c:    Parse input strings into tokens */

#include <stdio.h>
#include <string.h>

main()
{
   char s[81], *break_set =
     "\t\n\f\v\\\"~!@#$%^&*()-_=+'' [] {}|;:/?.,<>";

   while (gets (s))
   {
       char *tokp, *sp = s;

       while ((tokp = strtok(sp,break_set)) != NULL)
       {
          puts(tokp);
          sp = NULL; /* continue in this string */
       }
   }
   return 0;
}

/* End of File */