Earlier we used to use the NULL macro which is synonymous to int zero. This came as an inheritance from C language where 0 plays a double role (as an int and as NULL pointer).
NULL pointer in C language is defined as either ((void *) 0 ) or 0 (int), but in C++ it is defined as int 0 for most of the cases.
If NULL is defined as 0 (int zero), and there are two overloaded functions:
void fun(int); void fun(int*);
Now function call
fun( NULL );
will call fun(int)which may not be the intention.
To overcome this ambiguity C++ introduced new, strongly-typed keyword nullptr. nullptr is applicable to all pointer categories including function pointers and pointer to class members.
fun(0); // Call fun(int) fun(nullptr); // call fun( int* )
Previous: Range Based for loop similar to for-each