We’re Officially Live — Lifetime Founding Membership Available for a Limited Time
Free preview

What Is a Program?

A program is text on disk until you compile it. Walk through the source → compile → run loop you'll repeat thousands of times.

15 min read

In this lesson:


A program is just text, until it isn't

Open a .c file in any editor and you'll see characters: letters, brackets, semicolons. That is the source code. Your CPU cannot execute those characters directly, it only understands numeric instructions wired into its silicon.

Bridging that gap is what a compiler does. It reads your text file and produces a different file made of CPU instructions, called an executable (or "binary"). When you run the executable, the operating system loads it into memory and tells the CPU to start executing from a known entry point.

So a program lives in three forms at three moments:

  hello.c              hello (executable)         running process
  ───────              ─────────────────          ────────────────
  text you type   →    bytes the CPU runs    →    instructions
                                                  actually executing
       │                       │                          │
   "source"               "compiled"                  "running"

The minimum C program

Here is a complete program. Every line is doing real work; nothing is decoration.

#include <stdio.h>          // pull in printf and friends
 
int main(void) {            // execution starts here
    printf("hello, world\n");
    return 0;               // 0 means "ran successfully"
}

Line by line:


The compile / run loop

The full cycle in a terminal:

$ gcc hello.c -o hello        # compile: text → executable
$ ./hello                     # run: ask the OS to execute it
hello, world
$ echo $?                     # check the return code from main()
0

A picture of what just happened:

flowchart LR
  A[hello.c<br/>source text] -->|gcc| B[hello<br/>executable]
  B -->|./hello| C[Running<br/>process]
  C -->|return 0| D[Exit code<br/>back to shell]

You will run that two-step cycle (compile, then run) thousands of times across your career. Get comfortable with it now.


Compiled vs interpreted, and why it matters

C is compiled: you translate the whole file ahead of time, once, into a binary that runs at native CPU speed. Python and JavaScript are interpreted: there is no separate compile step you run by hand; an interpreter reads your source and executes it on the fly.

Compiled (C, C++, Rust) Interpreted (Python, JS)
Build step Yes, must compile before running No, just run the source
Run-time speed Native CPU speed Slower, often 10-100×
Errors caught early Many, at compile time Most show up only at run time
Output Standalone executable Needs the interpreter installed

Embedded systems live in the compiled world for two reasons: a microcontroller has no interpreter sitting in flash waiting to run Python, and the predictability of native code is essential when timing matters. That is why this course is in C.


Gotchas


TL;DR

This is just the start

Sign up free to track progress on this lesson, get coding problems with the Run button, and unlock the full interview Q&A.

More in Programming Fundamentals

Variables & Data TypesOperators
Input & Output
Conditionals
The switch Statement
while & do-while Loops