Preprocessor Example In C


Preprocessor statements are those lines starting with '#' sign. An example is #include statement that we used to include stdio.h header file into our programs. Preprocessor statements are processed by a program called preprocessor before compilation step takes place. After preprocessor has finished its job, compiler starts its work.

How to print a “Name” without using a semicolon

#include<stdio.h> #define PI 3.14 #define ERROR_1 "File not found." #define QUOTE "Hello World!" main() { printf("Area of circle = %f * diameter", PI ); printf("\nError : %s",ERROR_1); printf("\nQuote : %s\n",QUOTE); }

Output:-

Area of circle = 3.140000 * diameter
Error : File not found.
Quote : Hello World!