//try 一 try

#pragma back(push)
#pragma pack(2)
struct E
{
    char a;
    short b;
    double c;
    float d;
    char e;
};
#pragma back(pop)

int ECount = sizeof(E);
cout << "E count = " << ECount << endl;  //E count = 18

struct F
{
    char a;
    short b;
    double c;
    float d;
    char e;
};
int FCount = sizeof(F);
cout << "F count = " << FCount << endl;  //F count = 18 应该为24

 

sizeof 计算结构体大小请参考:https://www.cnblogs.com/azbane/p/11299353.html

相关文章:

  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2021-09-10
猜你喜欢
  • 2021-12-23
  • 2021-05-26
  • 2022-12-23
  • 2021-11-09
  • 2022-01-04
相关资源
相似解决方案