What happens when you type gcc main.c?

First of all we have to know that C is a general purpose computer programming language. It is very versatile and has been used to create operating systems and application softwares.

We also have to know that, in order to make the programs executables we have to iniciate the compiling process. Now you may ask…. What is that??

When we type gcc we are starting the GNU Compiling Collection (it is also used in many languages). In order to start this process we have to assign a file to it, so it can compile something, in this case the main.c

Lets look at what gcc does step by step…

1- Preprocessor- This step will erase everything that we dont need of our code, such as comments.

2- Comiplation- It will translate the human code to assembly code.

3- Assembly- This step translates the assembly code that the compilation step give us into binary code.

4- Linking- At last this step make our program executable, it links all the parts of the code, sucha as libraries to make it work.

So gcc main.c will compile the main.c file…