title: Copying a unsigned char array using memcpy in C
body: <pre><code>int n=50;
  unsigned char bytes[4];
  unsigned char *buffer=(unsigned char*)malloc(sizeof(int));
  bytes[0]=(n&gt;&gt;24)&amp;0xFF;
  bytes[1]=(n&gt;&gt;16)&amp;0xFF;
  bytes[2]=(n&gt;&gt;8)&amp;0xFF;
  bytes[3]=n&amp;0xFF;
  
  memcpy(buffer,bytes,sizeof(bytes));
  </code></pre>
  
  <p>This does not copy the bytes array to buffer. Any idea why?? What can be done to copy the array to buffer??</p>
  
  <p>When I try to print the sizeof(buffer)  or the contents after memcpy it shows 0 and no contents.
  I need to copy it to buffer as I have other information to append to the buffer along with bytes.</p>