Академический Документы
Профессиональный Документы
Культура Документы
DIRETIVES
BY
C MANASA
ASST. PROFESSOR
DEPT. OF ISE
PRE PROCESSOR
• Program that processes the source code before it passes through the
compiler
Directive Function
#define Defines a macro substitution
#undef Undefines a macro
#include Specifies the files to be included
#ifdef Test for macro substitution
#endif Specifies the end of #if
#ifndef Test whether a macro is not
defined
#if Test a compile-time condition
#else Specifies alternatives when #if
test fails
THREE CATEGORIES
#undef identifier
FILE INCLUSION
fact.h p1.c
COMPILER CONTROL DIRECTIVES
Compiler control directives are: #ifdef ,#endif ,#ifndef ,#else, #if
• Situation 1: Suppose there is a file ontaining some macro definitions. It is not know
whether a particular macro has been defined or not. To test whether a particular
macro has been defined in that header file use #ifndef