Saturday, 26 June 2010

Preprocessor Directives

Definition:
Compiler and a linker interact to give the executable file. Actually, before compiling, a process called 'preprocessing' is done on the source code(ie xx.c) by a program called the 'Pre-processor'.

Example: #include<stdio.h>//this line is known as preprocessor directive


Directive   Description
#define      Substitutes a preprocessor macro.
#include     Inserts a particular header from another file.
#undef       Undefines a preprocessor macro.
#if              Tests if a compile time condition is true.
#else          The alternative for #if.
#elif
#else
and
#if                in one statement.
#endif          Ends preprocessor conditional.
#ifdef           Returns true if this macro is defined.
#ifndef         Returns true if this macro is not defined.
#error           Prints error message on stderr.
#pragma       Issues special commands to the compiler, using a standardized method.



No comments:

Post a Comment