What happens when you type gcc main.c

The brain of a computer only understand one language (the machine code) so through the compilation process the computer can compile several source files into a single program.
First (Preprocessing): This step removes all the comments from our program main.c. This process fixes the source, once it’s done, the source code will be ready for the actual compilation.
The second step (Compilation): In this process, the output of the preprocessor is passed into the compiler and the compiler generates assembly code. The brain of the machine will start to add different components onto the stack. Assembly language describes the individual instructions the central processor will have to follow when running the program.
Step 3 (Assembly): Since our computers cannot interpret assembly code, the job of the assembler is to convert assembly code into binary code (base2-Binary) since that is what the computer’s metal can actually read and write to.
The final step (Linking: put it all together): The linker accepts the "main" file at the beginning as input and once it has all of the separate pieces of object code, you need to fit them together like jigsaw pieces to form the executable program.
The images and part of the Theoretical information were extracted from "Head First C by David Griffiths. Dawn Griffiths