Guest User

Untitled

a guest
Jul 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4.  
  5. int main (void)
  6. {
  7.   char buffer [1023];
  8.   char *split;
  9.   char *inverse[1023];
  10. //  char end;
  11.    int i = 0;
  12.    int x = 0;
  13.  
  14.  
  15.   printf ("Please enter a string: ");
  16.  
  17.   fgets(buffer,1023, stdin);
  18.   split = strtok( buffer, " ");
  19. //  end = strlen(split) - 1;
  20.   while (split != NULL)
  21.   {
  22.     inverse[i] = split;
  23. //    printf("%s \n", split);
  24.     split = strtok (NULL, ", ");
  25.     i++;
  26.   }
  27.   for (;i >=  0; i--)
  28.   printf("%s ", inverse[i]);
  29.   return 0;
  30. }
Add Comment
Please, Sign In to add comment