C Preprocessor

C Preprocessor

                      Preprocessor directives are actually the instructions to the compiler itself. They are not translated but are operated directly by the compiler. Note that preprocessor statements begin with a #symbol, and are NOT terminated by a semicolon. Traditionally, preprocessor statements are listed at the beginning of the source file.They are also termed as macros.

The most common preprocessor directives are
  • include directive
  • define directive

1.include directive:

                     The include directive is used to include files like as we include header files in the beginning of the program using #include directive like
#include<stdio.h>
#include<conio.h>

2.define directive:

                      It is used to assign names to different constants or statements which are to be used repeatedly in a program. These defined values or statement can be used by main or in the user defined functions as well. They are used for
a. defining a constant
b. defining a statement
c. defining a mathematical expression

For example
#define PI 3.141593
#define TRUE 1
#define floatingpointno float

                      Let us take a look at an example to understand how to use preprocessors in C Programming.

Ready to get started?

Ready to embark on your journey into the world of C programming? Our comprehensive course provides the perfect starting point for learners of all levels. With engaging lessons, hands-on exercises, and expert guidance, you'll gain the skills and confidence needed to excel in this fundamental programming language. Let's dive in and unlock the endless possibilities of C programming together!