int main()
{
  struct node
  {
    char i;
    int a;
  };
  printf("sizeof(struct node) =%d\n",sizeof(struct node));
  return 0;
}
The output for this program is 8 byte. Here sizeof(int)+size(char) is not equal to 8 byte. Still, we are getting 8 byte. It is because of padding. Thats fine. But in the following program, this very concept is being violated. Why?
int main()
{
  struct node
  {
    double i;
    int a;
  };
  printf("sizeof(struct node) =%d\n",sizeof(struct node));
  return 0;
}
if sizeof(double) is 8 byte then sizeof(struct node) should be 16 byte(as per first program). But it is printing 12 byte. Why?
 
     
     
    