Preprocessor directives are actually the instructions to the compiler itself.
They are operated directly by the compiler.
The most common preprocessor directives are:
- include directive
- define directive
include directive:
The include directive is used to include files.
Example :
#include <stdio.h>
Here, stdio.h is a header file and the preprocessor replace the above line with the contents of header file.
define directive :
It is used to assign names to different constants or statements which are to be used repeatedly in a program.
These defined values or statement can be used by main or in the user defined functions as well.
Preprocessing directive #define has two forms.
- #define identifier token_string
- Macros with argument
NOTE :
- Preprocessor statements begin with a hash symbol(#).
- Preprocessors are NOT terminated by a semicolon.
No comments:
Post a Comment