Accessing Structure Address via Member Variables in C Language
1. The specific code and analysis are as follows #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <stddef.h> /* Use a hypothetical structure at address 0 to get the offset of member */ #define OffsetOf(type,member) ( (unsigned int)&((type*)0)->member ) #if 0 /* typeof is an extension keyword of GCC compiler, mainly used to get the type … Read more