3. FUNCTIONS PERFORMED BY
PREPROCESSER
• Macro expansion
• File inclusion
• Miscellaneous directives
• Conditional directives
4. MACRO EXPANSION
• #define for defining a macro string
• #undef for undefining a macro string
• #error for printing error message
• #pragma issues a special command to compiler
MISCELLANEOUS DIRECTIVES
MACRO EXPANSION
• #include for including files
5. CONDITIONAL DIRECTIVES
• #ifdef returns true when macro is defined
• #ifndef returns true when macro is not defined
• #if checks condition compile time
• #else alternative of #if
• #elif combination of #if & #else
• #endif ends preprocessor condition
6. PREDEFINED MACROS
• __FILE__ displays file name
• __DATE__ displays current system date
• __LINE__ displays current line of cursur
• __TIME__ displays current system time
7. DIFFERENCE BETWEEN MACROS AND
FUNCTION
MACROS
• Macros are just a text
substitution tool
• This increases size of
program
• Best result and efficiency is
achieved from a function
when they are short and
frequently used
• Macros are not executable
FUNCTIONS
• In c when one function make
call to another function it is
done in several steps which
takes time such as saving of
system space ,stack
loading,etc
• This decreases size of
program
• Best result and efficiency is
achieved from a function
when they are long and
8. <CTYPE.H> MACROS
Macro
name
details
isalpha() Returns true if variable is character
isdigit() Returns true if variable is digit
isspace() Returns true if variable is space
isupper() Returns true if variable is uppercase
islower() Returns true if variable is lowercase
isxdigit() Returns true if variable is hexadecimal
isascii() Returns true if variable is ascii value
isprint() Returns true if variable is printable
ispunct() Returns true if variable is special character
isalnum() Returns true if variable is alphanumeric