What happens when you type gcc main.c
C is a programming language that need a compiler to convert machine code from source code. When your building your projects in C there is four base components that can translate the project into binary code for your computer to understand. Lets break it down in detail. I will describe each step in order to follow the compiling process.
Step 1: Preprocessor-responsible for removing comments, expansion of Macro expressions and included files and will output filename.i
Step 2: Compiler-will input filename.i to compiled assembly level instructions and output filename.s
Step 3: Assembler-will input the assembly filename.s to produce machine codes and will output object files (.o, .obj)
Step 4: Linker-will input the object files(.o, .obj) from the assembly while combining with Static Library to produce executable files or library.
Lets say main.c is one of the projects your working on. To start using this compiler, in your terminal please type:
gcc main.c
gcc which stands for GNU Compilier Collection will process the main.c file following step 1 to 4.