The #if and #elif directives compare the value of constant_expression to zero:
.----------------. V | >>-#--+-if---+--constant_expression----token_sequence-+-------->< '-elif-'
If the constant expression evaluates to a nonzero value, the lines of code that immediately follow the condition are passed on to the compiler.
If the expression evaluates to zero and the conditional compilation directive contains a preprocessor #elif directive, the source text located between the #elif and the next #elif or preprocessor #else directive is selected by the preprocessor to be passed on to the compiler. The #elif directive cannot appear after the preprocessor #else directive.
All macros are expanded, any defined() expressions are processed and all remaining identifiers are replaced with the token 0.
The constant_expression that is tested must be integer constant expressions with the following properties:
defined identifier defined(identifier)
For example:
#if defined(TEST1) || defined(TEST2)
#if TEST >= 1 printf("i = %d\n", i); printf("array[i] = %d\n", array[i]); #elif TEST < 0 printf("array subscript out of bounds \n"); #endif