Compiling Stages in C programming | How "Compilation" work

There are four process for compiling 

1- Preprocessing

2- Compilation

3- Assambly

4- Linking

(5- Loading)




1) Preprocessing :-  

  • esme hamare comments ko remove kiya jata hai. 
  • Micros ko expand kiya jata hai.
  • jitne bhi #include vale unke content ko utha kr ek file me save kr diya jata hai .
  • ye .i file hoti hai 
  • .i file me preprocess output hota hai.

Comments:- Aise code jo excute n ho vo comment kahlate hai
                        agr kisi line ke starting me '/' laga de to vo line excute nhi hoti hai



2) Compilation:- 

  • assambly level instructiion me convert kiya jata hai
  • yah .i file ko .s file me save krta hai


3) Assambly :- 

  • .s file ko machine level instruction me convert kiya jata hai.
  • yah .o file hoti hai aur ye machine level instruction hai


4)Linking :-

  • Linker sari .o file ko combine kr ke ek excutive bana deta hai
  • linker 2 trh ke hote hai :                                                                                                                        i)Static linking   ii)Dynamic linking 






(5) Loading) :- Linking ke bad RAM me load hota hai phir vaha se Run krta hai 







Loading or Loader



















Comments