I think you are confused. The code from the tutorial creates a pointer and initializes it to NULL , and then it tests if it is NULL . The reason you are not checking if *p != NULL is because it will be testing if what it points to is NULL and not checking if the pointer itself is NULL .
Of course, you can test *p for whatever value you like if it is a valid pointer ... It all depends on what you want to do.
EDIT:
You have not assigned NULL to *p , you have assigned it p . Statement int *p = NULL; same as entry:
int *p; p = NULL;
int * is a type.
Basically, when you write: if(p != NULL) , you just test if p points to such a place that it is safe to use *p .
source share