Preprocessor in C Language

Theoretically, the “preprocessor” is a translation phase that is applied to the source code before the compiler gets its hands on it.

The C Preprocessor is not part of the compiler, but is a separate step in the compilation process.

C Preprocessor is just a text substitution tool, which filters your source code before it is compiled. The preprocessor more or less provides its own language, which can be a very powerful tool for the programmer.

All preprocessor directives or commands begin with the symbol “#”.

The preprocessor makes programs easier to develop, read and modify. The preprocessor makes C code portable between different machine architectures & customizes the language.

The preprocessor performs textual substitutions on your source code in three ways:

  1. File inclusion: Inserting the contents of another file into your source file, as if you had typed it all in there.
  2. Macro substitution: Replacing instances of one piece of text with another.
  3. Conditional compilation: Arranging that, depending on various circumstances, certain parts of your source code are seen or not seen by the compiler at all.

The syntax of the preprocessor is different from the syntax of the rest of C program in several respects. The C preprocessor is not restricted to use with C programs, and programmers who use other languages may also find it useful. However, it is tuned to recognize features of the C language like comments and strings.

One thought on “Preprocessor in C Language

Leave a Reply

Your email address will not be published.

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

%d bloggers like this: