The Guide
Explain It Like I'm 5

Programming

What's Programming? How Does It Work?

What's Programming?

Programming is our way of building applications and systems by converting text language into a language the machine can understand

How Does It Work?

Let's assume we're using the C language:

Example

hello.c
    #include <stdio.h>

    int main() {
        printf("Hello world\n");

        return 0; // Process return code -> 0 means no errors
    }

Linux:

    gcc hello.c -o hello

Linux:

    ./hello

Output:

    user@computer$ ./hello
    Hello world
    user@computer$
  1. You run the command
    gcc hello.c -o hello
  1. The gcc compiler reads the file (entrypoint)
  2. First it gets all the referenced headers, in our case:
    #include <stdio.h> // stdio.h is the referenced header file
  1. Now it expands any macros you defined with #define (none in our case)
  2. Removes any comments we've made to our code (like the one I made with the return code)
  3. Converts the code to Assembly code that match the compiling computer architecture (x86 / ARM)
  4. Converts that Assembly code into binary (bits and bytes)
  5. Links calls to external functions mentioned in the header files, in our case:
    printf();
  1. Outputs the final file with the name we selected:
    hello

On this page