Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. while (strlen != 0) // strlen = length of string -1 (for '\0')
  2. {
  3.     while (input[strlen] == ' ')
  4.     {
  5.         //Scan through the word in reverse after encountering the space - 'asdf fsa worrld' -
  6.         //'world' is encountered first - we reverse that, then continue to the rest
  7.         int z;
  8.         {
  9.             //print the word in reverse
  10.             //x is = to letters in the word
  11.             for (z = 0; z < (x+1); z++)
  12.             {
  13.                 printf("%c\n", input[strlen+z]);
  14.             }
  15.             x=0;
  16.             strlen--; //to skip the ' '
  17.         }
  18.         x++; //increment for every char that isn't a ' '
  19.         strlen--;
  20.     }
  21. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement