C is an imperative (procedural) language. All the code has to be inside a function and must be compiled to output an executable file. Created by Dennis Ritchie and Kenny Thompson (K & R), is one of the most used programming languages in the world.
GCC is a compilator that recibes a program and generates a binary program in the machine language . GCC stands for GNU’s not Unix Compiler Collection.
The syntaxis goes: gcc [option | file]… i.e gcc file_name.c compiles and generates and executble files a.out
Compilation process takes 4 steps showed above in the graphic. To go from a programm written by a human to an executable file type gcc main.c and the source code is going to transform within four steps:
1. Preprocessing
This stage of the compilation, the preprocessor interpret preprocessor directives. These directives are statements that begin with “#define” (i.e. #include).
gcc -E $CFILE
2. Compiling
Allows for the preprocessed code to be translated to assembly instructions in the machine.
gcc -S $CFILE
3. Assembling
Is where the machine language instructions get created and then the object file is generated. Basically, the compiler is converting the syntax into machine level code.
gcc -c $CFILE
4. Linking
To link C functions of the code, like printf, that are already assambled and comipled in libraries. its important to takethe binary code form the fonctions to the executable.
gcc -o $CFILE
That happens when you type gcc main.c
Thank you and keep coding