|
1234567891011121314151617181920212223 |
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- int main () {
- // char str[80] = "This is - www.tutorialspoint.com - website";
- char *str=malloc(30);
- scanf("%s",str);
- const char s[2] = "-";
- char *token;
-
- /* get the first token */
- token = strtok(str, s);
-
- /* walk through other tokens */
- while( token != NULL ) {
- printf( " %s\n", token );
-
- token = strtok(NULL, s);
- }
-
- return(0);
- }
|