title: reversing only certain words of a string
body: <p>I have a string with the name "Mustang Sally Bob"
  After i run my code i want the string output to be like this: <code>gnatsuM yllaS boB</code>
  My approach is to count the words until the space and save the index of where the space is located in the string. then Then I want to print the characters starting from the space backwards.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      char* test="Mustang Sally Bob";
  
      int length; //string length
      int x;
      for(length=0;test[length] !=0&amp;&amp;test[length];length++); //get string length
      int counter;
      int words = 0;
      int space_index =0;
      for(counter=0;counter&lt;length;counter++) {
          words++;
          if(test[counter]==' ') {
              space_index=counter;
              for(x=space_index-1;x&gt;=words;x--) {
                  printf("%c",test[x]);
              }
              words=0;    
              space_index = 0;
          }
      }
  
      return 0;
  }
  </code></pre>
  
  <p>but when I execute this code the output I get is <code>yllaS g</code> 
  does anyone know why i cant get the full string?</p>