Complation in C
Viktor Dev ??
HTML | CCS | JAVASCRIPT | PYTHON | BOOTSTRAP | WORDPRESS DJANGO | DOCKER | AWS | GIT | MYSQL | MONGODB | JAVA | .NET
Compilation for?C?
Today we live in a world connected thanks to technologies that provide life, from knowing the health of our pets, going through analysis of our dream, manage the lighting or temperature of our house, home, review the expiration of products in the Fridge, manage our Windows or Mac computer, manage our Android or iPhone phone and endless things we can do or discover a click away or a notification from our smartphone.
But, this power is not born alone. All this can be done to different programming languages that are responsible for reading and interpreting all our desires. These languages are a compilation of orders, structures and functions that one or many programmers have had the work of performing from a company in Silicon Valley or from the garage of their home.
Today we can get a wide variety of programming languages that are responsible for bringing a very small idea that is to fulfill the necessary tasks, but do you have an idea of one that is present in our day by day without realizing it?
Language C
At first we mentioned the use of smart computers and telephones, then, the C language is present in the Kernel and the Windows operating system, Mac, Android and iOS. As if that were not enough, it is also part of Linux and databases such as Oracle and MySQL.The base of the world.
Nothing of this was possible if there was no programmer that spends hours to make this possible to give it a correct compilation and give us a finished product ready to use.
Compile? Yes. This is due process to have a product that we will consume as users and that we will discover in brief steps to better understand this process.
It is known among programmers that the files written in language must end in?.c and must be compiled with the GCC command (GNU Compiler Collection).
To achieve a correct compilation we must follow 4 essential steps:
-Preprocessing: In this first step the compiler reads the instructions written on the Header of the C file that start with #, which has as a task:
-removing comments
-expanding macros
-expanding included files.
When we write #Include <stdio.h> the compiler what is inside of STDIO and copied it into the Header of the file.c
-Compiling: For this step the compiler transforms the archive into an intermediate legible code for humans generating an assembler code.
-Assembly: In this step, the magic of being a simple code to become a binary code which is known the machines interpret perfectly.
-Linking: When the compiler reaches this step, it proceeds to link the libraries used with one single, there is also status linking and dynamic linking.
Let’s see an example of compiling a test file which tells us if the user is greater or less than dependent on what you enter.
This is the code:
Through the GCC command we make the compilation of our code:
Now we have our compilation?.exe for Windows in this case:
Thus it would be our execution of code:
References:
https://www.crehana.com/co/blog/desarrollo-web/ventajas-desventajas-lenguaje/
https://en.wikipedia.org/wiki/Kernel_(operating_system)
https://www.trytoprogram.com/c-programming/c-programming-history/
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html