我想要offsetof()参数行mystruct1.我试过了
offsetof(struct mystruct1, rec.structPtr1.u_line.line)
Run Code Online (Sandbox Code Playgroud)
并且
offsetof(struct mystruct1, line)
Run Code Online (Sandbox Code Playgroud)
但都不起作用.
union {
struct mystruct1 structPtr1;
struct mystruct2 structPtr2;
} rec;
typedef struct mystruct1 {
union {
struct {
short len;
char buf[2];
} line;
struct {
short len;
} logo;
} u_line;
};
Run Code Online (Sandbox Code Playgroud)