title: C memcpy issues with unsigned char array
body: <p>I have a question about memcpy that I hope someone can answer. Here's a short demonstrative program:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdlib.h&gt;
  
  
  int main (int argc, char **argv){
    unsigned char buffer[10];
    unsigned short checksum = 0x1234;
    int i;
    memset(buffer, 0x00, 10);
    memcpy(buffer, (const unsigned char*)&amp;checksum, 2);
    for(i = 0; i &lt; 10; i ++){
      printf("%02x",buffer[i]);
    }
    printf("\n");
    return 0;
  }
  </code></pre>
  
  <p>When I run this program, I get 34120000000000000000.<br>
  My question is why don't I get 12340000000000000000?</p>
  
  <p>Thanks so much</p>