相关疑难解决方法(0)

这些空指针,还是地址为0的指针?

如果我写

int zero = 0;

void *p1 = (void *)0;
void *p2 = (void *)(int)0;
void *p3 = (void *)(0 /*no-op, but does it affect the next zero?*/, 0);

void *p4 = (void *)zero;    // For reference, this is a pointer to address zero
void *p5 = 0;               // For reference, this is a null pointer
void *p6 = NULL;            // For reference, this is a null pointer
void *p7 = nullptr;         // For reference, this is a null pointer …
Run Code Online (Sandbox Code Playgroud)

c c++ null nullptr language-lawyer

18
推荐指数
3
解决办法
888
查看次数

标签 统计

c ×1

c++ ×1

language-lawyer ×1

null ×1

nullptr ×1