1.26.2013

C Preprocessor

What is C Preprocessor?

It is a program that processes our source program before it is passed to the compiler.

Preprocessor command also known as directives.

Each preprocessor directory is begin with a # symbol.

It is can be placed anywhere in the program but are most often placed at the beginning of a program.

The C program is often known as 'Source Code'. The preprocessor works on the source code and creates 'Expanded Source Code'.
If the source code is stored in a file say MYPROG.C, then the expanded source code gets stored in a file MYPROG.I. It is this expanded source code that is sent to the compiler for compilation.

Example of some preprocessor directives as:

  • Macro Expansion
  • Conditional compilation
  • File inclusion
  • Miscellaneous directives

We discuss all above preprocessor in detailed one by one.

No comments:

Post a Comment