How C Processor Works | Processing of Preprocessor Directives with Flowchart

January 26, 2012 No Comments » Hits : 297





How C Processor Works | Processing of Preprocessor Directives with Flowchart

Working of Pre-processor Directive

Explanation of Working :

Step 1 : Writing c Program

#include<stdio.h>
#include<conio.h>
#define MAX 10

void main()
{
int i = MAX;

printf("Age of Child : %d",MAX);

getch();
}

Suppose we have written above C Program.(hello.c)


Step 2 : Is there any C Preprocessor Directive ?

  1. Pre-processor means (Pre Pocess : Process it first).
  2. Preprocessor directives are processed before giving source code to Compiler.
  3. First Preprocessor will check whether given source code contain any preprocesssor directive or not.
  4. Yes,We have preprocessor directives in our code. so preprocessor will modify original source code and make it compiler readable.
  5. Preprocessor does different functions , [Tasks Performed by Preprocessor]
  6. After Pre-processor Phase modified program is -
void main()
{
int i = 10;
printf("Age of Child : %d",10);
getch();
}

Step 3 : Compiler Phase

  1. Compiler will compile program , creates object code.

Conclusion : Preprocessor Directives

  1. Preprocessor Processes Source Code before giving it to compiler.
  2. It is Compiler Independent.

Incoming search terms: