if (p), where p is a pointer

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Fri Sep 13 10:44:18 AEST 1985


> 	if (ptr)
is perfectly okay

> 	if (ptr != NULL)
is also okay and may be better style

NULL is #defined in <stdio.h> and other places as 0.
Do not confuse NULL (or its macro expansion, 0) with
a null pointer.  NULL is an integer constant (after
macro expansion).

Are you confused yet?



More information about the Comp.lang.c mailing list