Definitions of Source Code, Assembly Code, Object Code, Machine Code

  • Source Code:
    Human-readable code written in a programming language like C, Python, or Java.
  • Assembly Code:
    Low-level code with readable instructions (mnemonics) specific to a machine’s architecture.
  • Object Code:
    Partially translated binary code, generated by a compiler or assembler, not directly executable.
  • Machine Code:
    Binary code (0s and 1s) directly understood and executed by the computer’s CPU.

Example of the Entire Process

1. Source Code (C program):

#include <stdio.h>
int main() {
int a = 5, b = 3;
printf(“Sum = %d\n”, a + b);
return 0;
}

2. Assembly Code (Generated by Compiler):

MOV AX, 5
MOV BX, 3
ADD AX, BX
CALL PRINT

3. Object Code (Binary Instructions):

  • A partially linked .o file containing binary equivalents of the assembly instructions.

4. Machine Code (Executable):

  • The fully linked binary file (.exe or .out) that the CPU executes:

10110000 00000101 10110001 00000011 00000011 10101000 …

Leave a Comment

Your email address will not be published. Required fields are marked *