摘要: 最近在复习C语言,感觉自己以前对C的学习和认识简直是shit。今天看到有关结构体中成员存储分配的数据对齐问题,想和大家分享一下,也谈不上心得,就是想总结一下而已。有关数据对齐有两种,一种为自然对齐,一种为强制对齐。1.先看自然对齐,有如下程序: #include <stdio.h> typedef struct { char c1; long l; char c2; double d; }a; typedef struct { char c1; char c2; long l; double d; }b; int main() { printf("%d,%d\n" 阅读全文
posted @ 2011-08-08 21:58 王小兵 阅读(2652) 评论(9) 推荐(7) 编辑