NULL Pointer in C.

 #include<stdio.h>

#include<conio.h>

int main()
{
    int b = 34;
    int *pt = &b;
    printf("The address of b is %d\n", pt);
   
    int a = 34;
    int *ptr = NULL;
    if (ptr!= NULL)

    printf("The address of a is %d\n", *ptr);
    else{
        printf("The pointer is a null pointer and can not be defrenced");
    }
    return 0;
}

OUTPUT:
The address of b is 6422288 The pointer is a null pointer and can not be defrenced

Comments

Post a Comment

Popular posts from this blog

C Program using continue statement

C program of WHILE Loop

C Program using DO WHILE loop

C Program using SWITCH statement

New Animated Login or signup page made by HTML, CSS and JavaScript.

C Program to print multiplication table of any number.

C Language Travel Agency Manager Exercise.

STRUCTURE IN C PROGRAMMING.