Tag: pointer arithmetic

在C中明显的NULL指针取消引用实际上是指针算术吗?

我有这段代码。 它似乎在这里取消引用空指针,但随后使用unsigned int对结果进行按位与运算。 我真的不明白整个部分。 它打算做什么? 这是指针算术的一种forms吗? struct hi { long a; int b; long c; }; int main() { struct hi ob={3,4,5}; struct hi *ptr=&ob; int num= (unsigned int) & (((struct hi *)0)->b); printf(“%d”,num); printf(“%d”,*(int *)((char *)ptr + (unsigned int) & (((struct hi *)0)->b))); } 我得到的输出是44.但它是如何工作的?