Skip to main content

Posts

Showing posts with the label Preprocessor Directives

Preprocessor Directives

In a C program, all lines that start with # are processed by preprocessor which is a special program invoked by the compiler. In a very basic term, preprocessor takes a C program and produces another C program without any # . There are 4 main types of preprocessor directives: Macros File Inclusion Conditional Compilation Other directives  All preprocessor commands begin with a hash symbol (#). It must be the first nonblank character, and for readability, a preprocessor directive should begin in the first column. The following section lists down all the important preprocessor directives Sr.No. Directive & Description 1   #define Substitutes a preprocessor macro. 2   #include Inserts a particular header from another file. 3   #undef Undefines a preprocessor macro. 4   #ifdef Returns true if this macro is defined. 5   #ifndef Returns true if this macro is not defined. 6   #if Tests if a compile time condition is true. 7   #else The alt