Home >>C Tutorial >C Preprocessor

C Preprocessor Directives

Preprocessor Directives in C

In order to transform the code created by the user before compilation, preprocessor directives in C are used that are basically a microprocessor. As it permits the users to add micros hence, it is known as the micro-preprocessor.

Point to be noted : These preprocessor directives are generally executed before the compilation.

These preprocessor directives in C language always starts with a # symbol.

Here is a list of all the preprocessor directives in C language along with a brief description:

Preprocessor Directives Description
#include In order to paste the code of the provided file in to the current file, this preprocessor directive is used.
#define In order to define constant or micro substitution, this preprocessor directive is used.
#undef In order to undefine the constant or macro defined by #define, this preprocessor directive is used.
#ifdef In order to check whether macro is defined by #define, this preprocessor directive is used.
#ifndef In order to check whether macro is not defined by #define, this preprocessor directive is used.
#if In order to evaluate an expression or a condition, this preprocessor directive is used.
#else In order to evaluate an expression or a condition if the condition of #if is false, this preprocessor directive is used.
#error In order to indicate error, this preprocessor directive is used.
#pragma In order to provide additional information to the compiler, this preprocessor directive is used.

No Sidebar ads