title: Reversing a string in C using while loop
body: <p>This code is basically supposed to take a string, lets say for example it is "abc de fgh" the output should be </p>
  
  <pre><code>cba
  ed
  hgf
  </code></pre>
  
  <p>My code shown here, does put the string into a line but it does not reverse them. I'm having trouble coming up with that part and how to use the char* s from my argument in the method. any help in the right direction would be great!</p>
  
  <pre><code>void stringReverse(char* s){
  
      char* i = 0;
      char* j = strlen(s)-1;
      //in order to swap the characters s[i] and s[j] make a temp
      char* temp;
  
      while(i &lt; j){
          temp = i;
          i = j;
          j = temp;
  
          i++;
          j--;
      }
      //end of the while loop means that it reversed everything (no need for if/else)
  }
  </code></pre>