Is NULL guaranteed to be 0?

前端 未结 2 841
清歌不尽
清歌不尽 2021-01-05 04:54

I was wondering if NULL is guaranteed to be 0 in C++, so I searched and came across these:


This answer states that:

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-05 05:08

    I think its fine practice to assume so. Having said that, it would be horrible practice to #undef NULL and or redefine it as something else. So long story short, it's not a 100% guarentee because it is possible to be something else, but it NEVER should be.

提交回复
热议问题