我正在研究如何在某个特定结构中找到特定变量的抵消。
I tried the following program .
struct info{
char a;
int b;
char c;
int d;
};
struct info myinfo;
int main(int argc, char **argv)
{
struct info *ptr = &myinfo;
unsigned int offset;
offset = (unsigned int) &((struct info *) 0)->d;
printf("Offset = %d
",offset);
return 0;
}
I just wanted to know how the line offset = (unsigned int) &((struct info *) 0)->d
works.
I am confused because of dereferencing of 0.