字节对齐计算
http://hi.baidu.com/kingstarer1985/item/caccdcd29cba7c2b39f6f7d6
#include "stdio.h" struct data { char a; int c; double b; }; int main() { printf("%d\n",sizeof(struct data)); return 0; }
答案:16
#include "stdio.h" struct data { char a; double b; int c; }; int main() { printf("%d\n",sizeof(struct data)); return 0; }
答案:24
struct data { char a; int b[2]; int c; };
答案:16
内存的对齐处理
http://blog.sina.com.cn/s/blog_5e3604840100dad8.html