ANSI C在<stddef.h>中定义了offsetof()宏,用offsetof(struct_type,name)可以计算出成员name在结构struct type中的偏移量,如果处于某种原因,需要自己实现这个功能,可以使用下面这样的代码:ANSI C在<stddef.h>中定义了offsetof()宏,用offsetof(s
ANSI C在<stddef.h>中定义了offsetof()宏,用offsetof(struct_type,name)可以计算出成员name在结构struct type中的偏移量,如果处于某种原因,需要自己实现这个功能,可以使用下面这样的代码:ANSI C在<stddef.h>中定义了offsetof()宏,用offsetof(s