首页 > 试题广场 >

对下面每个结构声明,确定每个字段的偏移量、结构总的大小,以及

[问答题]

对下面每个结构声明,确定每个字段的偏移量、结构总的大小,以及在x86-64下它的对齐要求:

A. struct PI { int i; char c; int j ; char d; };

B. struct P2 { int i; char c; char d; long j ; };

C. struct P3 { short w [3] ; char c[3] };

D. struct P4 { short w[5] ; char *c[3] };

struct P5 { struct P3 a[2] ; struct P2 t }; 

这道题你会答吗?花几分钟告诉大家答案吧!