How do we check if a pointer is NULL pointer?

前端 未结 8 2245
一向
一向 2020-12-01 11:56

I always think simply if(p != NULL){..} will do the job. But after reading this Stack Overflow question, it seems not.

So what\'s the canonical way to c

8条回答
  •  心在旅途
    2020-12-01 12:20

    Well, this question was asked and answered way back in 2011, but there is nullptrin C++11. That's all I'm using currently.

    You can read more from Stack Overflow and also from this article.

提交回复
热议问题