C is a high level programming language which converts a C code to executable which can be run in the respective target OS environment.<\/p>\n
Usually a C program code is written with an extension .c. An IDE or editor is used to add code to the programs. Once done a compiler is used to compile the program code to executable. Some IDE provide built-in compiler while others provide option to select the compiler and debugger.<\/p>\n
Steps involved in creating and executable.<\/p>\n
The compilation phase can be split into 4.<\/p>\n
Pre-processing phase includes the following sub phases. This will generate filename.s file(in linux) which does have the below steps completed.<\/p>\n
Compilation phase takes the pre-processed file and convert to assembly instructions. In case of linux it will generate the GNU assembly code.<\/p>\n
Assembly phase include converting the assembly code into object code. filename.s will be converted to filename.o in Linux. This file will contain machine level instruction.<\/p>\n
Linking phase is the final phase where the static libraries are linked as well as symbol lookup done for the dynamic libraries which are going to be loaded as part of run time load. The linker also add the extra code to call the main function as well as handling the exit from the program.<\/p>\n
Note:- gcc uses dynamic linking for the standard C library functions like printf.<\/p>\n
<\/p>\n