#include <iostream>
using namespace std;
union u{
int a[4];
char b;
double c;
};
struct s{
int a;
u b;
};
void main(int argc, char *argv[])
{
cout << sizeof(s) << endl;
system("pause");
}
关于字节对齐
最新推荐文章于 2022-08-24 10:25:25 发布
#include <iostream>
using namespace std;
union u{
int a[4];
char b;
double c;
};
struct s{
int a;
u b;
};
void main(int argc, char *argv[])
{
cout << sizeof(s) << endl;
system("pause");
}