C – Preprocessor 2017-08-07T14:53:45+00:00

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, these 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

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

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


Output :

a = 3.141593

PI = 3.141593

Prev Next