Javatpoint Logo
Javatpoint Logo

C #undef

The #undef preprocessor directive is used to undefine the constant or macro defined by #define.

Syntax:

Let's see a simple example to define and undefine a constant.

Output:

Compile Time Error: 'PI' undeclared

The #undef directive is used to define the preprocessor constant to a limited scope so that you can declare constant again.

Let's see an example where we are defining and undefining number variable. But before being undefined, it was used by square variable.

Output:

225
Next TopicC #ifdef


Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA