Syntax
![]()
If the condition specified in the #if, #ifdef, or #ifndef directive evaluates to 0, and the conditional compilation directive contains a preprocessor #else directive, the source text located between the preprocessor #else directive and the preprocessor #endif directive is selected by the preprocessor to be passed on to the compiler.
The following example defines MAX_LEN to be 50 if EXTENDED is not defined for the preprocessor. Otherwise, MAX_LEN is defined to be 75.
#ifndef EXTENDED # define MAX_LEN 50 #else # define MAX_LEN 75 #endif
![]()
Preprocessor Directives - An
Overview
![]()
Conditional Compilation - #if, #elif
Conditional Compilation - #ifdef
Conditional Compilation - #ifndef
Conditional Compilation - #endif
Macro Definition and Expansion - #define
Example of Preprocessor
Directives
