title: C++ sizeof(struct)
body: <p>code like this:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(){
    struct{
       unsigned char a:4;
       unsigned char b:4;
    }i;
  
    struct{
       unsigned char a:4;
       unsigned char b:4;
       unsigned char c:4;
    }j;
  
    i.a = 1;
    i.b = 1;
    j.a = 1;
    j.b = 1;
    j.c = 1;
    printf("size of i is: %d, size of j is: %d", sizeof(i), sizeof(j));
    return 0;
  }
  </code></pre>
  
  <p>why the output is 1 2? means size of i possess 1 byte, j possess 2 bytes. we know unsigned char have 1 byte, so why i not equal 2? i am sorry for my english.</p>