Preprocessor in c

Chapter 8:Preprocessor And Complex Declarations

    Preprocessor in c

  • Preprocessor – why?

              The unique feature of C compilers is preprocessing. It is the first step in the C program compilation stage. In simplistic terms, a C Preprocessor is just a text replacement tool and they instruct compiler to do needed preprocessing prior to real compilation. The result of preprocessing is a single file which is then passed to the actual compiler. All preprocessor directives or commands begin with pound symbol #. It provides its individual language which can be a very powerful tool to the programmer. It makes programs easier to develop, to read, to modify and makes code more transportable between various machine architectures. The C Preprocessor is also referred as the CPP. It also permits us customize the language.

    For example we can replace { ... } instead of begin and end:

    #define begin {
    #define end }

              Now every occurrences of begin can be replaced by {,then end can be replaced by } at that time of compilation. So any difference does not known by the following C compilation stage.

© 2015 by Learncertification All Rights Reserved. The certification names are the trademarks of their respective owners. Terms & Privacy Policy