Preprocessor Directives

Not every line in a C program is an executable statement. Programs can also contain “preprocessor directives”—commands for the QuickC compiler. A directive begins with a number sign (#) and does not end with a semicolon.

The second and third lines of VOLUME.C contain preprocessor directives. The #include directive in the second line tells QuickC to insert the file STDIO.H when it compiles VOLUME.C:

#include <stdio.h>

STDIO.H is one of the many “header files” supplied with QuickC. Header files contain declarations and definitions required by C library functions. (“Library functions” are supplied with QuickC rather than written by you.) In the VOLUME.C program, the printf library function requires information from the STDIO.H header file.

The #define directive in the third line defines a symbolic constant named PI:

#define PI 3.14

Wherever PI appears later in the source program, QuickC substitutes the text 3.14. The text can be any combination of letters, digits, or other characters. The effect is much like a search and replace operation in a word processor.