title: Why is my union's size bigger than I expected?
body: <p>When I print the size of a union like this:</p>
  
  <pre><code>union u {
    char c[5];
    int i;
  } un;
  </code></pre>
  
  <p>using this:</p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[])
  {
      printf("size of union = %d ",sizeof(un));
      return 0;
  }
  </code></pre>
  
  <p>I get an answer of 8 using Visual C++, but I expected 5. Why?</p>
  
  <p>Well, for the same example,
  i did something like this:</p>
  
  <pre><code>int i1 = 0x98761234;
  un.i = i1;
  printf("\n un.c[0] = %x ",un.c[0]);
  printf("\n un.c[1] = %x ",un.c[1]);
  printf("\n un.c[2]= %x ",un.c[2]);
  printf("\n un.c[3] = %x ",un.c[3]);
  printf("\n un.c[4] = %x ",un.c[4]);
  printf("size of union = %d ",sizeof(un));
  </code></pre>
  
  <p>i got results like </p>
  
  <pre><code>un.c[0] = 34;
  un.c[1] = 12;
  un.c[2] = 76;
  un.c[3] = ffffff98;
  </code></pre>
  
  <p>why are there 6fs at un.c[3]</p>