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

+1

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

Zuke

6 Answers

New Answer

0

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.

+7

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

+7

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

+2

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

+1

Ooooh! That makes sense. Thanks! :D

0

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