Advertisement
llvlleo1810

Tách từng từ trong một chuỗi

Aug 6th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <String.h>
  3. #define SEPARATOR " "
  4. int main()
  5. {
  6.     char s[100];
  7.     printf("");
  8.     gets(s);
  9.    
  10.     char *p;
  11.    
  12.     p = strtok(s, SEPARATOR);
  13.     while(p != NULL){
  14.         printf("%s\n",p);
  15.         p = strtok(NULL,SEPARATOR);
  16.     }
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement