#pragma 函数的问题?
#include<iostream.h>#pragma(8)
struct example1
{
short a;
long b;
}
struct example2
{
char c;
example1 struct1;
short e;
}
#pragma pack()
int main(int argc,char *argv[])
{
example2 struct2;
cout<<sizeof(example1)<<endl;
cout<<sizeof(example2)<<endl;
cout<<(unsigned int)(&struct2.struct1)-(unsigned int)(&struct2)<<endl;
return 0;
}
输出结果是:8,16,4
请问结果16,4怎样求出?
主函数括号中表示什么意思?
结构体中的变量a,b,c,e和结果有关系没?