Other Directives
The #undef directive cancels an earlier #define definition. The #if, #ifdef, #ifndef, #else, #elif, and #endif directives are typically used to produce files that can be compiled in more than one way.
The #undef Directive
The #undef directive undefines a given #define. That is, suppose you have this definition:
#define LIMIT 400
Then the directive
#undef LIMIT
removes that definition. Now, if you like, you can redefine LIMIT so that it has a new value. Even if LIMIT is not defined in the first place, it is still valid to undefine it. If you want to use a particular name and you are unsure whether it has been used previously, you can undefine it to be on the safe side.
With some compilers, you can redefine a defined name ...
Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.