can anybody please tell me the significance of the origin of the name nullptr in c++11 because the same could be done before using 0 or NULL i.e. for example:
1 2 3 4 5 6 7 8 9 10
double* p0 = nullptrif(p0)
//is same as
if(p0 !=0)
//is same as(?)
if(p0 !=NULL)
//is same as(?)
if(p0 != nullptr)
It has type. A 0 can represent integer, float, char, pointer, ... but nullptr has its type. Therefore, the compiler can be much more strict about type correctness, and catch some unintended implicit conversions (i.e. errors).
What keskiverto meant was that nullptr is specifically for pointer(of any type) only.
Imagime if you have function overloads, one taking an int, and the other a pointer say char*. If you are to pass NULL as an argument to the pointer overload, the compiler will select the int overload.