title: Reverse a string without using standard functions
body: <p>I recently got asked this during an interview.  As a recent graduate, and only been programming about 2 years (all school work), I was at a loss.  I had a vague idea, but I'm sure I failed it.  This is what I'd written:</p>
  
  <pre><code>string Reverse(string word, string reversed)
  {
      if(word.length() == 0)
      {
          return reversed;
      }
      else
      {
          string temp;
          reversed = word.substr(0,1) + reversed;
          temp = word.substr(1);
          Reverse(temp, reversed);
      }
  
      return reversed;
  }
  </code></pre>
  
  <p>Now that I'm home, I'm testing it, and the return is only the first letter in the input.  I'm vaguely familiar with the concept of recursion, but I'm obviously failing at this.  Any help/pointers/suggestions are very much appreciated.  Thank you.</p>
  
  <p>EDIT:
  Following Dennis Meng's post, I've made the following change:</p>
  
  <pre><code>string Reverse(string word, string reversed)
  {
      if(word.length() == 0)
      {
          return reversed;
      }
      else
      {
          string temp;
          reversed = word.substr(0,1) + reversed;
          temp = word.substr(1);
          return Reverse(temp, reversed);
      }
  }
  </code></pre>
  
  <p>Now, I get the proper return value.  Thank you so very much.  </p>