Hello, World!
The main goal of compilation is to convert high-level language to low-level language which is synonymous with C programming. Compilation takes a source code file, usually a C program file and convert it into an executable file. The compilation process has four key stages: Preprocessing, Compiling, Assembly and Linking.
A few things occurs at the Preprocessing stage. First, comments are removed from the source code because they don't need to be processed. Second, header files are pulled because they are needed for function declarations. Lastly, macros are redefined into codes. In Compiling, the source code is translated to an assembly code because by itself it isn't executable so it would pass into the next stage. At Assembly, the assembly code is then translated to an object code that's binary. Finally, at Linking, the object code paired with libraries produces an executable file.
The following is a classic example of the shell commands used in compilation.
In all starts with a source code file. In this case, the image to the right displays the code to print "Hello, World!"
At Preprocessing, use command gcc with -E option to stop compilation at the end of this stage.
At Compiling, use command gcc with -S option to stop compilation from going into the next stage.
At Assembly, use command gcc with -c option and it would stop compiling at this stage.
At Linking, use command gcc, then the file name and lastly, the executable file name.