Preprocessor in C

In c programming languages, Preprocessor is a macro processor, processes all the preprocessor directives present in the source code before the compilation. Preprocessor always starts with # sign.
Preprocessor is also called as text substitution tool or CPP.

Preprocessor has following features:

1) Header file inclusion: It includes header files.
2) Macro expansion: It replaces all the macro with the given substituted text.
3) Conditional compilation: allows to add or avoid program part on basis of given condition.
4) Line control: It is called as preprocessor line control directive gives the line number of next source line.

Following are the preprocessor directives:

#defineSubstitutes a preprocessor macro
#includeInserts a particular header from another file
#undefUndefines a preprocessor macro
#ifdefif macro is defined, Returns true.
#ifndefif macro is not defined, Returns true.
#ifChecks if a condition is true in compile time.
#elseThe alternative for #if.
#elif#else and #if in one statement.
#endifEnds preprocessor conditional.
#errorPrints error message on stderr.
#pragmaProvides extension specific to the compiler.