offsetof(s,m):简单的讲就是假设s的地址为0,然后获得m相对于s的偏移地址,其中m是struct结构s的成员. s为struct类型结构,m为struct中的结构成员. /* offsetof example */ #include <stdio.h> #include <stddef.h> struct mystruct { char singlechar; char arraymember[10]; char anotherchar; }; int main () { printf ("offsetof(mystruct,singlechar) is %d/n",offsetof(mystruct,singlechar)); printf ("offsetof(mystruct,arraymember) is %d/n",offsetof(mystruct,arraymember)); printf ("offsetof(mystruct,anotherchar) is %d/n",offsetof(mystruct,anotherchar)); return 0; } 示例代码..编译输出看结果能很好的理解.