title: sizeof struct with union
body: <p>I'm very confused by the whole 'data alignment' thing:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(){
      struct st{
          int i,*p;
          char c;
          union { char type[4]; unsigned char d;} un; 
      };
  
      struct st s1={25,&amp;a,'X',"asdf"};
      printf("sizeof s1 is %d",sizeof(s1));
      return 0;
  }
  </code></pre>
  
  <p>due to data alignment, i thought that since the sizes of</p>
  
  <pre><code>int i : 4 bytes
  int *p : 8 bytes
  char c : 1 byte(+3)
  union : 4 bytes
  </code></pre>
  
  <p>the output would be 20, but this outputs <code>sizeof s1 is 24</code>!
  Why is it outputting 24? Does this regard int *p, which is 8 bytes?</p>