Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main (void)
- {
- char buffer [1023];
- char *split;
- char *inverse[1023];
- // char end;
- int i = 0;
- int x = 0;
- printf ("Please enter a string: ");
- fgets(buffer,1023, stdin);
- split = strtok( buffer, " ");
- // end = strlen(split) - 1;
- while (split != NULL)
- {
- inverse[i] = split;
- // printf("%s \n", split);
- split = strtok (NULL, ", ");
- i++;
- }
- for (;i >= 0; i--)
- printf("%s ", inverse[i]);
- return 0;
- }
Add Comment
Please, Sign In to add comment