Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not equal to 0 checks for non null on pointer?

Tags:

c++

Where p is the name of a pointer, does p != 0 return a bool that is true where p is null (not pointing at anything) ?

like image 688
alan2here Avatar asked Dec 05 '25 13:12

alan2here


1 Answers

Yes. The C and C++ standards specify that the 0 pointer is not a valid memory location.

like image 166
dappawit Avatar answered Dec 08 '25 03:12

dappawit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!