undef directive

If you want to nullify the effect of the define directive and specify a new value, then you can use the undef directive.


#include <stdio.h>
#define VAL 40;      //A
#undef VAL           //B
#define VAL 40       //C
int main()
    printf ("%d\n", VAL);   //D
    return 0;

Statement A defines VAL as 40, that is, an erroneous definition.

Statement B indicates that the afore mentioned definition no longer exists.

Statement C allows a new definition.

Statement D uses new definition of 40.

Point to Remember
The undef directive nullifies the effect of an earlier definition.


You may also like...