What happens when you type gcc main.c
As a summary, we can say that the compilation process has four stages or steps that allow our C high-level code to become an executable code with a plus: we can execute each of them and take control of them. Let's see:
For example, if I want to see the result of each stage we can execute:
In the above image we can see how to take the source code and become it preprocessed code!
Once we had preprocessed, we can generate the assembly code like the previous image show us.
At this point, you can generate the object code (binary), and to be ready to create the executable file if you want.
Of course, you can generate the process in only one sentence, but under the hood, the compiler executes each step. And, on the other hand, we can generate until intermediate stages to take to another process.