ComputerGeek
search
Code: Definition, Types, and Examples Updated: Mar. 13 2026 | Created: Jan. 29 2026

What is Computer Code?

Computer code is a set of instructions written to tell a computer what to do. These instructions can be created in a form that humans can read, or in a form that computers can directly understand and execute.

In simple terms, computer code is the language used to communicate with computers.

There are several types of computer code, but the most common ones include source code, machine code, bytecode, pseudocode, and markup or styling code.

Source Code

Source code is a human-readable set of instructions written using programming languages such as C, C++, Python, Java, and many others. Developers write source code to create software, applications, and operating systems.

This type of code is easy for humans to read and understand, but it usually needs to be compiled or interpreted before a computer can run it.

#include <stdio.h>

int main() {
    printf("Hello, World!");
    return 0;
}

Machine Code

Machine code is the lowest-level form of computer code. It consists of raw binary instructions written in 0s and 1s, which are directly executed by the computer’s hardware (CPU).

Unlike source code, machine code is not readable by humans and is specific to a particular processor architecture.

Assembly Code:

section .data
    msg db "Hello, World!", 0xA  ; 0xA is the newline character (\n)
    len equ $ - msg              ; Calculate the length of the string

section .text
    global _start

_start:
    ; 1. Setup the sys_write syscall
    mov rax, 1          ; syscall number for sys_write
    mov rdi, 1          ; file descriptor 1 (stdout)
    mov rsi, msg        ; pointer to the string
    mov rdx, len        ; length of the string
    syscall             ; call the kernel

    ; 2. Setup the sys_exit syscall
    mov rax, 60         ; syscall number for sys_exit
    mov rdi, 0          ; exit code 0
    syscall             ; call the kernel

Hexadecimal Code:

48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21

Binary Code:

01001000 01100101 01101100 01101100 01101111 00101100 00100000 01010111 01101111 01110010 01101100 01100100 00100001

Bytecode

Bytecode is an intermediate type of code that sits between source code and machine code. It is designed to be platform-independent, meaning it can run on different operating systems using a virtual machine or interpreter.

A common example of bytecode is Java bytecode, which allows the same program to run on Windows, macOS, or Linux without rewriting the source code.

Source Code (example.java):

public class Hello {
    public static void main(String[] args) {
        int a = 5;
        int b = 10;
        int result = a + b;
        System.out.println(result);
    }
}

Bytecode (example.class):

public static void main(java.lang.String[]);
    Code:
       0: iconst_5        // Push integer 5 onto the stack
       1: istore_1        // Store 5 into local variable 1 (a)
       2: bipush        10 // Push integer 10 onto the stack
       4: istore_2        // Store 10 into local variable 2 (b)
       5: iload_1         // Load value from variable 1 (5)
       6: iload_2         // Load value from variable 2 (10)
       7: iadd            // Pop both, add them, push result (15)
       8: istore_3        // Store result (15) into variable 3
       9: getstatic     #2 // Get the static field System.out
      12: iload_3         // Load the result (15)
      13: invokevirtual #3 // Call println() method
      16: return          // Exit the method

Pseudocode

Pseudocode is an informal, human-readable way of writing instructions. It is used to outline the logic and steps of a program without following the strict rules of any programming language.

Pseudocode is not meant to be executed by a computer—it is mainly used for planning, teaching, and explaining how an algorithm works.

BEGIN
    SET attempts = 0
    SET max_attempts = 3
    SET authorized = FALSE

    WHILE attempts < max_attempts AND authorized is FALSE
        PROMPT user for "Username" and "Password"
        READ username, password

        IF username equals "admin" AND password equals "12345" THEN
            SET authorized = TRUE
            PRINT "Access Granted"
        ELSE
            INCREMENT attempts
            PRINT "Invalid credentials. Try again."
        END IF
    END WHILE

    IF authorized is FALSE THEN
        PRINT "Account Locked: Too many failed attempts."
    END IF
END

Markup and Styling Code

Markup and styling code are used to structure and format content rather than perform calculations or logic. These codes define how text, images, and layouts appear on a screen.

Common examples include:

These types of code are widely used in websites and documentation.

HTML or HyperText Markup Language Code:

<!DOCTYPE html>
<html>
    <head>
        <title>ComputerGeek</title>
    </head>
    <body>
        <h1>ComputerGeek</h1>
        <p>Digestive answers to all computer related questions.</p>
    </body>
</html>

CSS or Cascading Style Sheet Code:

h1 {
    font-size: 24px;
}

p {
    font-size: 16px;
}

MD or Markdown Code:

# Heading 1

A paragraph for heading 1.

## Heading 2

A paragraph for heading 2.

Conclusion

Computer code is the foundation of all modern technology—from simple web pages to complex operating systems. While different types of code serve different purposes, they all work together to turn human ideas into instructions that computers can understand and execute.

Understanding these basic types of computer code is an important step toward learning how software and digital systems really work.