NULL POINTER - C-Tutorial

Latest

Monday, 3 October 2016

NULL POINTER

NULL POINTER


            A pointer variable can also be initialized in such a way that it does not point to any data type.  Such a pointer is known as a NULL pointer.
            A null pointer is a special type of pointer that cannot points to anywhere.  Null pointer is assigned by using the predefined constant NULL; which is defined by several header files including stdio.h, stdlib.h and alloc.h.

            Example:        int *p=NULL;

/* EXAMPLE PROGRAM FOR NULL POINTER */
#include<stdio.h>
main()
{
            int *p;
            clrscr();
            p=NULL;
            printf("\nValue :%d",*p);

}

No comments:

Post a Comment