首页 > 代码库 > Why isn't sizeof for a struct equal to the sum of sizeof of each member?

Why isn't sizeof for a struct equal to the sum of sizeof of each member?

check here.

Basically the compiler will insert unused memory into a structure so that data members are optimally aligned for better performance.

Why isn't sizeof for a struct equal to the sum of sizeof of each member?