title: Copy two parts of a string to two other strings using strncpy
body: <p>I want to copy two parts of string s to two strings a and b:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main()
  {
     char s[] = "0123456789ABCDEF";
     char a[10];
     char b[6];
     strncpy( a, s, 10 );
     a[10] = '\0';
     printf("%s\n", a);
     strncpy( b, s+10, 6 );
     b[6] = '\0';
     printf("%s  %s\n", a, b);
     return 0;
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>0123456789
    ABCDEF
  </code></pre>
  
  <p>I had expected</p>
  
  <pre><code>0123456789
  0123456789  ABCDEF
  </code></pre>
  
  <p>What has happened to a? Can anybody tell me what is wrong?</p>