次の C コードを検討してください。
#include <stdio.h>
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);
}
出力は次のとおりです。
4 30 36
構造体のサイズが個々のコンポーネント変数のサイズの合計と等しくないのはなぜですか?