C null pointer

What is Null Pointer ?

  • NULL Pointer is a pointer which is pointing to nothing.
  • NULL pointer points the base address of segment.

NULL is macro constant which has been defined in the header file

  • stdio.h
  • alloc.h
  • mem.h
  • stddef.h
  • stdlib.h as -
#define NULL 0

Visual Representaion :

Some Examples of NULL Pointer

float *ptr=(float *)0;
char *ptr=(char *)0;
double *ptr=(double *)0;
char *ptr='\0';
int *ptr=NULL;