在比较指针与“NULL”时,应该使用“==”运算符而不是“=”运算符,例如:
int *ptr = NULL; if (ptr == NULL) { // do something }
上一篇:比较指针与静态变量的行为是什么?
下一篇:比较指针与引用