C Programming Language

C Preprocessor

                      Preprocessor directives are actually the instructions to the compiler itself. They are not translated but are operated directly by the compiler. Note that preprocessor statements begin with a #symbol, and are NOT terminated by a semicolon. Traditionally, preprocessor statements are listed at the beginning of the source file.They are also termed as macros.

The most common preprocessor directives are
  • include directive
  • define directive

1.include directive:

                     The include directive is used to include files like as we include header files in the beginning of the program using #include directive like

2.define directive:

                      It is used to assign names to different constants or statements which are to be used repeatedly in a program. These defined values or statement can be used by main or in the user defined functions as well. They are used for
a. defining a constant
b. defining a statement
c. defining a mathematical expression

For example
#define PI 3.141593
#define TRUE 1
#define floatingpointno float

                      Let us take a look at an example to understand how to use preprocessors in C Programming.

Graphics Home Standard Library functions

c program stats