The code in C language undergoes these steps before execution.
1. Source Program: This is the code you write in the C compiler. When the Compile button is clicked, a ‘.c’ or ‘.cpp’ file(whatever the language is used) is made.
2. Preprocessor: After the .c/cpp file is created, the preprocessor phase is executed. The preprocessor processes the preprocessor statements( the statements preceded by a hash<#> sign) and removes the comments that are based just for documentation. A preprocessed file is created after this step.
3. Compilation: In this phase, the syntax of the program is checked. If there is any compilation or syntax error, that is reported in this phase. After this phase, a .obj (object file is created).
4. Linking: A linker links the code of the accessed library functions or other functions used in the code with the program. An executable image of the program is made in this step.
5. Loading: Loading is putting the program into the memory for execution.
6. Executable File: An executable file is created in this step. If Run command is given, this file is executed.
Nice tutorial of compiler. 🙂