Code for Preprocessor Directives

Code for Preprocessor Directives is:

Before a C program is compiled in a compiler, source code is processed by a program called preprocessor. This process is called preprocessing.

Commands used in preprocessor are called preprocessor directives and they begin with ''#'' symbol. Below is the list of preprocessor directives that C language offers.

1 Macro
syntax:
#define 
This macro defines constant value and can be any of the basic data types.

2 Header file inclusion 
syntax:
#include <file_name>
The source code of the file ''file_name'' is included in the main program at the specified place

3 Conditional compilation
syntax:
#ifdef, #endif, #if, #else, #ifndef
Set of commands are included or excluded in source program before compilation with respect to the condition

4 Other directives 
syntax:
#undef, #pragma
#undef is used to undefine a defined macro variable.
#Pragma is used to call a function before and after main function in a C program

Share this post


Comments (0)

  • Be first to comment

Leave a comment

or to Comment

Contact Us

  • Address: # 650 Narsi Village Sector 32 Urban Estate Karnal-132001 Haryana, India

  • Phone:(+91) 97289-77666   Email: codethor84@gmail.com


Follow Us