difference between NULL and nullptr in c++
NULL
- It is not defined by c++.
- It is internally mapped to into(zero).
Example
int f1 (char*);
int f1 (int);
char*ptr = NULL; // pointer
if we have a NULL pointer then function call int f1 (cptr) would always map to f1(int) and not to int f1 (char*).
nullptr
- It has been defined by c++.
- nullptr is a legal empty/ null pointer.
Example
int f1 (char*);
int f1 (int);
char*ptr = nullptr; // pointer
if we have a nullptr pointer then function call int f1 (cptr) will map to int f1 (char*) only.