Professional Documents
Culture Documents
Miscellaneous Topics: Dr. Mayank Swarnkar
Miscellaneous Topics: Dr. Mayank Swarnkar
Week-14
Exercise: Enter ‘n’ numbers using CLA and find the smallest and
largest among them.
cptr
10 bytes of space
Directive Function
#define Defines a macro substitution
#undef Undefines a macro
#include Specifies the files to be included
#ifdef Test for a macro definition
#endif Specifies the end of #if
#ifndef Tests whether a macro is not defined
#if Tests a compile time condition
#else Specifies alternatives when #if test fails
Table: Popular Preprocessor Directives
#include <mymacros.h>
#ifndef PI
#define PI 3.14
#endif
Figure: Condition-1
Figure: Condition-2
.....
.....
#ifdef TEST1
{
some print code
}
#endif
.....
.....
#ifdef TEST2
{
some print code
}
#endif
.....
.....
Figure: Condition-3
#elif
#pragma
#error
Stringizing Operator (#)
Token Pasting Operator (##)