If you are using C++11 then use nullptr
:
int *p = nullptr;
If you are not using C++11 then use NULL
instead:
int *p = NULL;
Do not define your own null
value at all, since C/C++ already has one of its own. NULL
has no type, it is simply defined as 0
, and an integer literal 0
can be assigned to a pointer:
int *p = 0;