Next: #define Up: Programming in C Previous: Exercises

The C Preprocessor

Recall that preprocessing is the first step in the C program compilation stage - this feature is unique to C compilers.

The preprocessor more or less provides its own language which can be a very powerful tool to the programmer. Recall that all preprocessor directives or commands begin with a #.

Use of the preprocessor is advantageous since it makes:

The preprocessor also lets us customise the language. For example to replace {... }block statements delimiters by PASCAL like begin ... end we can do:

During compilation all occurrences of begin and end get replaced by corresponding {or }and so the subsequent C compilation stage does not know any difference!!!.

Lets look at #define in more detail



Dave.Marshall@cm.cf.ac.uk
Wed Sep 14 10:06:31 BST 1994