Knowledge is Power.

  • Who you are ?

    Working on machines without understanding them ? Then you should be here..

  • Where you are ?

    Geographical location should not become a barrier to Share our knowledge.

  • What do you do ?

    Puzzles and Interview question are intended to be discussed here.

    Monday, March 8, 2010

    • The C preprocessor is a program that processes our source program before it is passed to the compiler.
    • preprocessor is a separate program which transforms C source code containing preprocessor directives into source code with the directives removed.
    • The preprocessor is implemented as an integral part of an Standard C compiler.
    • gcc -E filename will show the preprocessed file.
    • Preprocessor commands are known as directives.
    • Preprocessor works on a line by line basis.
    • The preprocessor doesn't know about the scope rules of C. Preprocessor directives like #define take effect as soon as they are seen and remain in effect until the end of the file that contains them
    Preprocessor Directives:

    • The preprocessor commands are called as directives.
    • Each of these preprocessor directives begin with a # symbol.
    • The directives can be placed anywhere in a program but they are most often placed at the beginning of a program.
    • The preprocessor directives are classified in to 4 major categories

      1. Macro Expansion(#define)
      2. File Inclusion(#include)
      3. Conditional Compilation
      4. Miscellaneous directives
    • The 2 most frequently used features are #include,to include the contents of a file during compilation and #define ,to replace a token by an arbitrary sequence of characters.

    0 comments:

    Post a Comment