Access violation writing location?
<p>I am trying to write a function to reverse a string, but I got such exception when I am doing:  *str++ = *end;   anyone who knows what's the reason? Thanks in advance. </p>

<pre><code>void reverse(char* str)
 {
    char *end = str;
    char temp;
    if(str)
    {
      while(*end)
       {
     end++;
       }
    end--;

    while(str&lt;end)
    {
       temp = *str;
       *str++ = *end;
       *end--=temp;
    }
   }
 }
</code></pre>
