C Preprocessor

Defination of C preprocessor

  • The C preprocessor is not part of the comipler, but is a seperate step in compilation process.

  • Preprocessor is a program that processes source program before it is passed to the compiler.
  • The preprocessor offers several features called preprocessor directives.
  • Each of these preprocessor directives begin with a pound symbol(#) symbol.
  • The directives can be placed anywhere in a program but are most often placed at the beginning of a program, before the first function definition.

C preprocessor

We are going to learn the following preprocessor directives:

Following is a list of all important preprocessor directives:

    • #define – Substitutes a preprocessor macro.
    • #include – Inserts a particular header from another file.
    • #undef – Undefines a preprocessor macro.
    • #ifdef – Returns true if this macro is defined.
    • #ifndef – Returns true if this macro is not defined.
    • #if – Tests if a compiler time condition is true.
    • #endif – Ends preprocessor conditional.

Let us understand these features of preprocessor one by one.

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.