title: Copying integer to char buffer in C
body: <pre><code>  uint32_t after = 0xe1ca95ee;
    char new_buf[4];
    memcpy(new_buf, &amp;after, 4);
    printf("%x\n", *new_buf); // I want to print the content of new_buf
  </code></pre>
  
  <p>I want to copy the content of <code>after</code> to <code>new_buf</code>. But the result is confusing. <code>printf</code> gives me <code>ffffffee</code>. It looks like an address. I have already dereferenced <code>new_buf</code>. </p>
  
  <p>According to the comments, I can't use <code>memcpy</code> or <code>strncpy</code> to do this task. But why? <code>memcpy</code> and <code>strncpy</code> are only designed to handle <code>char *</code>? But the content of <code>after</code> is in memory.</p>
  
  <p>PS: I know I should use <code>sprintf</code> or <code>snprintf</code>. If you can explain why <code>memcpy</code> and <code>strncpy</code> is not for this case, I appreciate it.</p>