title: Basic C question on copying char arrays to char pointers
body: <p>I have some doubts in basic C programming.</p>
  
  <p>I have a char array and I have to copy it to a char pointer. So I did the following:</p>
  
  <pre><code>char a[] = {0x3f, 0x4d};
  char *p = a;     
  printf("a = %s\n",a);
  printf("p = %s\n",p);
  unsigned char str[] = {0x3b, 0x4b};
  unsigned char *pstr =str;
  memcpy(pstr, str, sizeof str);
  printf("str = %s\n",str);
  printf("pstr = %s\n",pstr);
  </code></pre>
  
  <p>My printf statements for pstr and str get appended with the data "a".
  If I remove memcpy I get junk. Can some C Guru enlighten me? </p>