title: recursive string reverse function
body: <p>writing a recursive string reverse function out of curiosity, but having a bit of problem with XOR there. The whole point of this function, is to not use iterator, which is why it is a recursive function. this is not homework, just curiosity. </p>
  
  <pre><code>    private static char[] ReverseNL(char[] arr, int index)
      {
          var len = arr.Length;
          if (index &gt; 0)
              arr[len - index] ^= arr[index - 1];
          return index-- &lt; 1 ? arr : ReverseNL(arr, index);
      }
  </code></pre>
  
  <p>it seems to jamble the first part of my string </p>
  
  <p>"hey there stack!" becomes "I♫→A ←E↨reht yeh"</p>
  
  <p>it is always the first half of the phrase that gets jumbled... </p>
  
  <p>UPDATE.. </p>
  
  <p>i suppose XOR wasn't really needed here.. so used basic assignment, also got rid of return.</p>
  
  <pre><code>    private static void ReverseNL(char[] arr, int index) {
          var len = arr.Length;
          if (index &gt; 0 &amp;&amp; index &gt; len / 2) {
              var c = arr[len - index];
              arr[len - index] = arr[index - 1];
              arr[index - 1] = c;
              index--;
              ReverseNL(arr, index);
          }
      }
  </code></pre>