C++ Swap string
<p>I am trying to create a non-recursive method to swap a c-style string. It throws an exception in the Swap method. Could not figure out the problem.</p>

<pre><code>void Swap(char *a, char* b)
{
    char temp;
    temp = *a;
    *a = *b;
    *b = temp;
}
void Reverse_String(char * str, int length)
{
    for(int i=0 ; i &lt;= length/2; i++)  //do till the middle
    {
        Swap(str+i, str+length - i);

    }

}
</code></pre>

<p>EDIT: I know there are fancier ways to do this. But since I'm learning, would like to know the problem with the code.</p>
