C examples for Preprocessor:Preprocessor Operators
The general form of #if is
#if constant-expression
statement sequence
#endif
If the constant expression is true, the code that is between it and #endif is compiled.
The #endif directive marks the end of an #if block. For example:
The following code displays the message on the screen because MAX is greater than 99.
The expression that follows the #if is evaluated at compile time. It can contain only previously defined identifiers and constants, no variables may be used.
#include <stdio.h> #define MAX 100//from www.j ava 2 s . com int main(void) { #if MAX>99 printf("Compiled for array greater than 99.\n"); #endif printf("outside.\n"); return 0; }