2. INTRODUCTION:
One of the unique feature of C language is
preprocessor.
The preprocessor is a program that processes
the source code before it passes through
compiler.
Pre processor directives are divided into 3
categories:
1.
Macro substitution directives
2.
File inclusion directives
3.
Compiler control directives
3. MACRO SUBSTITUTION :
Macro substitution is a process where an
identifier in a program replaced by predefined
string composed of one or more tokens.
It is achieved by #define directive.
FILE INCLUSION :
An external file containing functions or macro
definition can be included as apart of program
so that we need not rewrite those function or
macro definition.
This is achieved by #include directive.
4. ADDITIONAL PREPROCESSOR
DIRECTIVES
#ELIF DIRECTIVE: #ELIF enables us to establish
an if else if sequence for testing multiple
conditions.
#PRAGMA DIRECTIVE: #PRAGMA is an
implementation oriented directive that allows us to
specify various instructions to be given to
compiler.
Syntax: #pragma name
5. #ERROR : #ERROR directive is used to
produce diagnostic messages during
debugging.
Syntax: #error error message.
6. PREPROCESSOR OPERATORS
There are 2 preprocessor operations namely:
1.
Stringizing operator #
2.
Token pasting operator ##
Stringizing operator #: It is used in definition of
macro functions.
This
operator allows a formal argument within a macro
definition to be converted to a string.
Syntax:
#define sum(XY)printf(#xy”=%fn”,xy);
7. Token pasting operator ##:
The token pasting operator enables us to
combine two tokens within a macro definition
to form a single token.
Syntax:
#define combine(string1,string2) s1##s2.