C-#undef .

In this session i have discussed #undef preprocessor in C .


The #define preprocessor directive is used to undefine constant or macro that already declared by using #define in program .


Syntax

#undef identifier value


Example : Write a program that demonstrate the use of #undef .

    #include<stdio.h>
    #define PI 3.14
    #undef PI
    int main()
    {
        int r;
        float area;
        printf("Enter the radious");
        scanf("%d",&r);
        area=PI*r*r;
        printf("Area : %f",area);
        
        return 0;
    }
    
    OUTPUT : error PI undeclared
    

In the above code i have define the PI as macro . But use of #undef i have undeclared the PI in this program .


Welcome to AndroidATPoint.

back image                     next image