Why does sizeof a struct with char and int return 8 bytes instead of 5?

后端 未结 0 1168
滥情空心
滥情空心 2020-12-01 12:16

I have the following struct (C++ 11)

struct s {
    char i;
    int j;
};

sizeof(s) returns 8 using my compiler, but sizeof(char) is 1 and si

相关标签:
回答
  • 消灭零回复
提交回复
热议问题