title: Access violation when using strcpy?
body: <p>I've tried reinventing the strcpy C function, but when I try to run it I get this error:</p>
  
  <pre><code>Unhandled exception at 0x00411506 in brainf%ck.exe: 0xC0000005: Access violation writing location 0x00415760.
  </code></pre>
  
  <p>The error occurs in the <code>*dest = *src;</code> line. Here's the code:</p>
  
  <pre><code>char* strcpy(char* dest, const char* src) {
      char* dest2 = dest;
      while (*src) {
          *dest = *src;
          src++;
          dest++;
      }
      *dest = '\0';
      return dest2;
  }
  </code></pre>
  
  <p>EDIT: Wow, that was fast. Here's the calling code (strcpy is defined in mystring.c):</p>
  
  <pre><code>#include "mystring.h"
  #include &lt;stdio.h&gt;
  
  int main() {
      char* s = "hello";
      char* t = "abc";
      printf("%s", strcpy(s, t));
      getchar();
      return 0;
  }
  </code></pre>