Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 regels
449 B

  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. int main () {
  5. // char str[80] = "This is - www.tutorialspoint.com - website";
  6. char *str=malloc(30);
  7. scanf("%s",str);
  8. const char s[2] = "-";
  9. char *token;
  10. /* get the first token */
  11. token = strtok(str, s);
  12. /* walk through other tokens */
  13. while( token != NULL ) {
  14. printf( " %s\n", token );
  15. token = strtok(NULL, s);
  16. }
  17. return(0);
  18. }