The #if ... #else directive Example in C | C preprocessor programs
The #if ... #else is a preprocessor directive in C programming language and it is used for conditional compilation, where one of the code section needs to be compiled based on the condition from two given code sections.
General for of the #if ... #else directive is:
#if conditional_expression
statements-true;
#else
statements-false;
#endif
If conditional_expression is true, the code written between in #if block i.e. statements-true will be executed and if conditional_expression is false, code written in #else block i.e. statements-false will be executed.
Example:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer