title: size of struct in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member">Why isn&rsquo;t sizeof for a struct equal to the sum of sizeof of each member?</a>  </p>
  </blockquote>
  
  <p>Consider the following C code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;    
  
  struct employee
  {
    int id;
    char name[30];  
  };
  
  int main()
  {
    struct employee e1;      
    printf("%d %d %d", sizeof(e1.id), sizeof(e1.name), sizeof(e1));
    return(0);
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <p>4 30 36</p>
  
  <p>Why is the size of the structure not equal to the sum of the sizes of its individual component variables?</p>