NULL(3) Linux Programmer's Manual NULL(3) NAME NULL - null pointer constant SYNOPSIS #include <stddef.h> #define NULL 0 /* or otherwise */ DESCRIPTION NULL expands to some null pointer constant. Thus although it is not guaranteed to be a null pointer itself, it will result in a null pointer if converted to any pointer type. NOTES Null pointer constants are not guaranteed to be null pointers, merely to produce a null pointer if converted to pointer type. Using a null pointer constant where a pointer is required will almost always work, due to implicit conversions. The main modern context in which this is not so is functions with variable-length argument lists, where there is no implicit conversion. For example: printf("%p\n", NULL); /* wrong */ printf("%p\n", (void *)NULL); /* right */ printf("%p\n", (void *)0); /* also right */ execl(prog, prog, arg, NULL); /* wrong */ execl(prog, prog, arg, (char *)NULL); /* right */ The same issue arises when a function is called without a prototype in scope, but this should in any case be avoided in modern programs. Whether to use NULL or 0 where a null pointer constant is required is a stylistic issue. Other Headers NULL is also defined in <locale.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h> and <wchar.h>. CONFORMING TO ISO/IEC 9899 2005-02-03 NULL(3)