.. www.engineerscur.blogspot.com: What is c preprocessor?

What is c preprocessor?

What is c  preprocessor?

              In many c implementations,it is the first program included by us then by compiler as a first part of the program.This will replace the  preprocessor directive with the text of file which we want to include.

       There is lots of benefits of this type of file inclusion as we don't have to write common code in our every set of programs as we can make that code as header file and include it in upcoming programs.

       If we write below line in our program,

#include<stdio.h>

      This will read by compiler and it will find file named as stdio.h in system directory and replace #include<stdio.h> with the text file of the stdio.h which is also piece of code.

       It can also be written as,

#include "stdio.h"

      The only difference is of  < >  (angle brackets) and "" (double quotes).When we write the file which we want to include in program in < > (angle brackets) then compiler will search that file in  standard include paths of compiler.If we write it with double quotes "" then compiler will search that file in standard include path as well as in current source directory. 

      This type of (stdio.h)  file is known as header file.This include files are given .h extension and there are also other extensions than .h .