Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (strlen != 0) // strlen = length of string -1 (for '\0')
- {
- while (input[strlen] == ' ')
- {
- //Scan through the word in reverse after encountering the space - 'asdf fsa worrld' -
- //'world' is encountered first - we reverse that, then continue to the rest
- int z;
- {
- //print the word in reverse
- //x is = to letters in the word
- for (z = 0; z < (x+1); z++)
- {
- printf("%c\n", input[strlen+z]);
- }
- x=0;
- strlen--; //to skip the ' '
- }
- x++; //increment for every char that isn't a ' '
- strlen--;
- }
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement