title: C memory overlap?
body: <p>I am trying to copy the first 16 bytes of a 32 byte string to <code>dest</code>.</p>
  
  <pre><code>unsigned char src[32] = "HELLO-HELLO-HELLO-HELLO-HELLO-12";
  unsigned char dest[16];
  
  memcpy(dest, src, 16); // COPY
  
  printf("%s\n", src);
  printf("%lu\n", strlen(src));
  
  printf("%s\n", dest);
  printf("%lu\n", strlen(dest));
  </code></pre>
  
  <p>The output is the following</p>
  
  <pre><code>HELLO-HELLO-HELLO-HELLO-HELLO-12
  32
  HELLO-HELLO-HELLHELLO-HELLO-HELLO-HELLO-HELLO-12
  48
  </code></pre>
  
  <p>I was expecting to receive <code>HELLO-HELLO-HELL</code> in <code>dest</code> only.
  The first 16 bytes of <code>dest</code> actually contain the expected result.</p>
  
  <p>Why does <code>dest</code> more than it can actually hold?
  Why does it have a length of <code>16+32=48</code>?
  Is there a way to copy only the first 16 bytes of <code>src</code> to <code>dest</code>?</p>