#define FIND(struc,e) (size_t)&(((struc*)0)->e)

来源:互联网 发布:学生网络欺凌事件 编辑:程序博客网 时间:2024/04/28 07:05
#include <stdio.h>typedef struct TagTest{        int a;        char b[20];        double ccc;}test;#define FIND(struc,e) (size_t)&(((struc*)0)->e)int main(){        printf("%d\n",FIND(test,a));        printf("%d\n",FIND(test,b));        printf("%d\n",FIND(test,ccc));        return 0;}


[root@localhost ccy]# ./a.out 
0
4
24


0 0