The C preprocessor

 

Compile-time constants

#define PI.................... 3.14159
#define MAX_ARRAY_SIZE .....50
#define O_READONLY ..........0x40


Inserting files

#include <stdio.h> ..../* <...> for system include files */
#include "mydefs.h" .../* "..." for local include files */

Conditional compilation

#define DEBUG_ENABLED

#ifdef DEBUG_ENABLED
....dump_current_contents_of_data_structure();
#endif

Inline Macros

#define MAX(x,y)........ ( ( (x)>(y) )? (x) : (y) )
#define NEW(x) ..........(x *) malloc(sizeof x)

....best = MAX( one, the_other);
....very_best = MAX( MAX(a,b), c);
....p = NEW(struct listnode);