Namespaces
Variants
Views
Actions

NULL

From cppreference.com
< c‎ | types
Defined in header <stddef.h>
Defined in header <string.h>
Defined in header <wchar.h>
Defined in header <time.h>
Defined in header <locale.h>
Defined in header <stdio.h>
Defined in header <stdlib.h>
#define NULL /*implementation-defined*/

Expands into implementation-defined null-pointer constant.

[edit] Example

#include <stdlib.h>
 
struct S;
void(*f)() = NULL;
 
int main(void)
{    
    char *ptr = malloc(sizeof(char)*10);
    if (ptr == NULL) exit(EXIT_FAILURE);
    free(ptr);
    ptr = NULL;
 
    int* p = NULL;
    struct S *s = NULL;
 
    return EXIT_SUCCESS;
}

Possible output:

(none)

[edit] See also