You are on page 1of 1

C Compiler Reference Manual

Examples:

#id
#id
#id

0x1234
"serial.num"
CHECKSUM

Example Files:

ex_cust.c

Also See:

None

#IF expr
#ELSE
#ELIF
#ENDIF
Syntax:

#if expr
code
#elif expr //Optional, any number may be used
code
#else
//Optional
code
#endif

Elements:

expr is an expression with constants, standard operators


and/or preprocessor identifiers. Code is any standard c
source code.

Purpose:

The pre-processor evaluates the constant expression and if it


is non-zero will process the lines up to the optional #ELSE or
the #ENDIF.
Note: you may NOT use C variables in the #IF. Only
preprocessor identifiers created via #define can be used.
The preprocessor expression DEFINED(id) may be used to
return 1 if the id is defined and 0 if it is not.

Examples:

#if MAX_VALUE > 255


long value;
#else
int value;
#endif

44

You might also like