fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void extract(char *String, char* output)
  5. {
  6. char str[10][20];
  7. int x = -1,y = 0,z = 0;
  8. size_t n = 0;
  9. size_t end = strlen(String);
  10. for(; n < end ; ++n)
  11. {
  12. y++;
  13. if( String[n] == ' ' )
  14. {
  15. y = 0;
  16. z = 0;
  17. }
  18.  
  19. if( y == 1 )
  20. x++;
  21.  
  22. if( y > 0 )
  23. {
  24. str[x][z] = String[n];
  25. z++;
  26. str[x][z] = '\0'; //Comment this*********
  27. }
  28. }
  29. strcpy(output, str[7]);
  30.  
  31. }
  32.  
  33. int main()
  34. {
  35. char buffer[20];
  36. extract("POL POL POL POL POL POL POL POL POL POL", buffer);
  37. printf( "WORD : %s\n", buffer);
  38. return 0;
  39. }
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
WORD : POL