#undef Directive

Syntax: #undef <variable_name>

The #undef directive may appear anywhere inside the code. It need not appear at the beginning of a line. The directive and the variable name are case sensitive.

This directive deletes (i.e. undefines) the specified variable. Variables are defined (created) by using the #define directive.


  • It is harmful to undefine a variable which has not been defined before.
  • It is harmful to define a variable twice.
  • Variable names undefined by the #undef directive have nothing to do with local variables or parameters, even if they have the same name!