fork(2) download
  1. #include <string.h>
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. char str[80] = "This is - www.tutorialspoint.com - website";
  7. const char s[2] = "-";
  8. char *token;
  9.  
  10. /* get the first token */
  11. token = strtok(str, s);
  12.  
  13. /* walk through other tokens */
  14. while( token != NULL )
  15. {
  16. printf( " %s\n", token );
  17.  
  18. token = strtok(NULL, s);
  19. }
  20.  
  21. return(0);
  22. }
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
 This is 
  www.tutorialspoint.com 
  website