Are both null and NULL constants the exact same thing in C/C++?
I've noticed as I write my code in Visual Studio that null and NULL don't get the same syntax highlighting, and the compile outcome is not the same as having null instead of NULL in some sections of the code.
They might be, they might not be.
Both C and C++ define NULL, but in slightly different ways.
null is not part of either standard; it is neither a keyword nor a reserved word, so you can use it as a variable name, class name &c..
The preferred way of denoting pointer null-ness in C++ is nullptr which has type especially designed for pointer nullness.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With