title: Unable to print a pointer after using memcpy
body: <p>I'm trying to get my own version of memcpy to copy a character array from one pointer to another. However, this gives an error. It seems like there is an issue with printf.</p>
  
  <p>Secondly, the official memcpy function returns the destination pointer. Is that really required? If I modify *dest, it should be reflected in *d anyway. So what is the need to return anything?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void memcpy2(void *dest, const void *src, size_t n)
  {
      char *dp = dest;
      const char *sp = src;
      while (n--)
          *dp++ = *sp++;
  }
  
  int main(void) {
      char *c = "Hello";
      char *d=NULL;
      memcpy2(d,c,3);
      printf( "%c", *d);
      return 0;
  }
  </code></pre>