Home » C Programming » Tutorial »
Compilation Process & Execution of C Program
Compiler converts C programs into executable file. Compiler has four phases to ouptut an executable file. And these are -
- Pre-processing
- Compilation
- Assembly
- Linking
Pre-processing - This is the first phase through wich C code is passed. This phase has sub phases -
1. Removal of Comments
2. Expansion of Comments
3. Expansion of header file
Compiling - The next phase is to compile filename.i. In this phase filename.i is compiled into filename.s file. This file contains assembly level instructions. The extension of this file is filename.s
Assembly - In this phase the filename.s file is converted into object code which has .o extension. This file has machine level instructions. In this phase all code is converted into machine language except the library function like printf(), scanf() etc..Since this file contains machine code so we can't see its content.
Linking - Linking is last phase of compilation process. In this phase linking of library functions is done i.e functions definition is inserted into the file and linker knows from where the library function definition should be taken. This phase also increase the size of file as it adds the code from library functions.
C Tutorial
- History of C Language
- The First Program in C
- Compilation & Execution
- Compile C on Dev-C++
- Compile C on GCC Linux
- Variable & Data types
- Comments
- Storage Classes
- Conidtional Statements
- Switch Cases
- Loops (for, while, do-while)
- Arrays
- Pointers
- Function Pointer
- Strings & Library func
- Formated I/O
- Structure
- Enum
- Union
- File I/O
- Memory Management
- Error Handling
- Type Casting