#include
using namespace std;
struct A
{
char c;
};
struct B
{
char c;
int tmp;
};
struct C
{
char c;
char t[3];
int tmp;
};
struct D
{
int tmp;
char c;
};
struct E
{
int tmp;
char c[4];
};
int main()
{
cout<<sizeof(A)<<endl;
cout<<sizeof(B)<<endl;
cout<<sizeof(C)<<endl;
cout<<sizeof(D)<<endl;
cout<<sizeof(E)<<endl;
return 0;
}
//结果分别为
1
8
8
8
8
struct 结构体大小的判断
最新推荐文章于 2023-05-17 07:45:00 发布