Preprocessor directives in c programming
Preprocessor Directives :
The preprocessor, as its name implies, is a program that processes the source code, before it passes through the compiler. It operates under the control what is known as ‘Preprocessor directive’ or ‘Command line’. They are placed in source program before the main line.
- A preprocessor is a program that processes its input data to produce output, that is used as input to some other program. The output is known as the preprocessed form of the input data.
- Preprocessor commands are also known as directives. We have been using these directives in programming, since very first program of C.
- Preprocessing is the first step in the C program compilation stage.
# include <stdio.h>
- C preprocessor directives or commands begin with a #
Uses of the C preprocessor is advantageous, as it makes.
- Programs easier to develop.
- Easier to read and understand.
- Easier to modify.
- C code more portable between different machine architectures.
Explain Preprocessor Directives with Example :
These statements begin with a # symbol, and are also called preprocessor directives. These statements direct the C processor to include header files in a program.
Some of the preprocessor statements and header files are given below-
ftinclude <stdio.h> : for the standard input/ output functions.
//include <Test.h> : for file inclusion of header file test.
#define NULL 0 : for defining symbolic constant NULL = 0
//include <ct>nio.h> : for the console input / output function.
//include < string.h> : used for string.
//include <math.h> : used for math functions like cos, sine, log, cube, sqrt.
Submit your review