NULL Vs. 0 | SoloLearn: Learn to code for FREE!


NULL Vs. 0

Is there any difference between them? (C++) I say this, because I saw #define NULL 0 when I hovered over NULL in Visual Studio.

5/21/2018 7:59:48 PM


6 Answers

New Answer


You should not use NULL in C++ anymore. You can replace it with nullptr, which is safer. NULL in C++ is more of a 0, but nullptr is always a pointer.


0 is an integer value, like any other. Null means "no value assigned".


Because "zero seconds" lasts the same timespan as "no seconds" ;)


Then, how come time(NULL) and time(0) both work?


Ooooh! That makes sense. Thanks! :D


So, int main() and int main(NULL) are the same?