From its conception through execution, a computer program passes through numerous stages. From human-readable source code to binary-coded computer instructions (machine code). I will explain what a program goes through during its entire lifetime in this section.
Source code
A plain text file containing computer instructions written in a human-readable format is known as source code. It’s just a plain text file that programmers have created. It contains high-level language instructions that the programmer intended for a program to follow. After that, the source code is compiled and translated into Object code.
Object code
A sequence of computer instructions written in an intermediate language is known as object code. After the compilation process, the compiler generates it. The compiler analyses high-level source code and converts it to an intermediate language. Following translation, an object code file with instructions encoded in some intermediate language is created.
It’s worth noting that the intermediary language might or might not be machine language.
Object codes, despite being in binary, cannot execute on their own because they lack the main entry point. A linker links the various object codes together to create the final executable file.
Machine code
A set of computer instructions written or translated in machine language is known as machine code. It is the final executable file produced by compiling, assembling, or linking together many object files. It’s the CPU’s lone program that runs.
Machine code and object code are both written in machine language and have a similar appearance. Machine codes, on the other hand, can be executed directly, whereas object codes cannot. The consequence of connecting numerous object files together is machine code. Object code, on the other hand, is the result of converting the source code of a single module or program into machine language.