#include <iostream.h>2#pragma pack(8)3struct example1 {4 short a;5 long b;6};7struct example2 {8 char c;9 example1 struct1;10 short e;11};12#pragma pack()13 14int main(int argc, char* argv[])15{16 example2 struct2;17 cout << sizeof(example1) << endl;18 cout << sizeof(example2) << endl;19 cout << (unsigned int)(&struct2.struct1) - (unsigned int)(&struct2) << endl;20 return 0;21}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容