title: C Question: why char actually occupies 4 bytes in memory?
body: <p>I wrote a small program to check how many bytes char occupies in my memory and it shows char actually occupies 4 bytes in memory. I understand it's mostly because of word alignment and don't see advantage of a char being only 1 byte. Why not use 4 bytes for char?</p>
  
  <pre><code>int main(void)
  {
    int a;
    char b;
    int c;
    a = 0;
    b = 'b';
    c = 1;
    printf("%p\n",&amp;a);
    printf("%p\n",&amp;b);
    printf("%p\n",&amp;c);
    return 0;
  }
  </code></pre>
  
  <p>Output:
      0x7fff91a15c58
      0x7fff91a15c5f
      0x7fff91a15c54</p>
  
  <p>Update:
  I don't believe that malloc will allocate only 1 byte for char, even though sizeof(char) is passed as argument because, malloc contains a header will makes sure that header is word aligned. Any comments?</p>
  
  <p>Update2:
  If you are asked to effectively use memory without padding, is the only way is to create a special memory allocator? or is it possible to disable padding?</p>