2011-03-19 00:28:14|?次阅读|上传:wustguangh【已有?条评论】发表评论
24.
union a { int a_int1; double a_double; int a_int2; }; typedef struct { a a1; char y; } b; class c { double c_double; b b1; a a2; };
输出cout<<sizeof(c)<<endl;的结果?
答:
VC6环境下得出的结果是32
另:
我(sun)在VC6.0+win2k下做过试验:
short - 2
int-4
float-4
double-8
指针-4
sizeof(union),以结构里面size最大的为union的size
-----------------------------------------------------------------------------
25.i最后等于多少?
int i = 1; int j = i++; if((i>j++) && (i++ == j)) i+=j;
答:
i = 5
---------------------------------------------------------------------
26.
unsigned short array[]={1,2,3,4,5,6,7};
int i = 3;
*(array + i) = ?
答:
4
---------------------------------------------------------------------