Javatpoint Logo
Javatpoint Logo

C #ifdef

The #ifdef preprocessor directive checks if macro is defined by #define. If yes, it executes the code otherwise #else code is executed, if present.


Syntax with #else:

C #ifdef example

Let's see a simple example to use #ifdef preprocessor directive.


Value of a: 2

But, if you don't define NOINPUT, it will ask user to enter a number.


Enter a:5
Value of a: 5
Next TopicC #ifndef

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA