fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7. char str[200];
  8. char *arr[sizeof(str)/2] = {0};
  9. int n = 0, i;
  10.  
  11. if (fgets(str, sizeof(str), stdin) != NULL)
  12. {
  13. char *p = strtok(str, " \n");
  14. while (p != NULL)
  15. {
  16. arr[n++] = p;
  17. p = strtok(NULL, " \n");
  18. }
  19. }
  20.  
  21. for (i=0; i<n; ++i)
  22. printf("%s\n", arr[i]);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 2300KB
stdin
A simple   string parsing   program   that dissects words separated by     spaces

stdout
A
simple
string
parsing
program
that
dissects
words
separated
by
spaces