The preprocessing of C source code is done before it is compiled by the compiler. The Preprocessor directives are the command used for preprocessing which starts with "#" symbol. The list of preprocessor directives that C language offers is given below:
- Macro i.e. #define
- Header file inclusion i.e. #include.
- Conditional compilation i.e. #ifdef, #endif, #if, #else, #ifndef.
- Other directives i.e. #undef, #pragma, #undef.
Example program for #define, #include preprocessors in C:
#include <stdio.h>
#define height 150
#define number 8.78
#define letter 'D'
#define lettersequence "PQRS"
void main()
{
printf("value of height : %d \n", height );
printf("value of number : %f \n", number );
printf("value of letter : %c \n", letter );
printf("value of lettersequence : %s \n", lettersequence);
}
OUTPUT:
value of height : 150
value of number : 8.780000
value of letter : D
value of lettersequence : PQRS
0 Comment(s)