Member-only story
How Your Program Actually Runs: From C to CPU
The complete journey from compilation to hardware execution
Tarun Chandragiri10 min read·Just now--
//Adding 2 numbers
#include <stdio.h>
int main() {
int x = 5;
int y = 10;
int sum = x + y;
printf("Sum is: %d\n", sum);
return 0;
}It looks like a mix of English and math. And yet, a machine runs it.
But a machine doesn’t understand any of it. It doesn’t understand variables, numbers, printing or even “addition” the way you think. It only understands electrical signals — high or low, 1 or 0.
So, what actually happens between this code and those electrical patterns?
Most engineers learn parts of this system like compilers, CPU architecture, and digital logic separately. Each piece makes sense on its own, but the full system never really clicks.
When you connect these layers, things start to make sense.
So instead of treating them as isolated topics, we’ll follow this simple program all the way down — from code, to instructions, to hardware, to silicon.
The Preprocessor — Before Compilation Even Starts
Before your compiler sees a single line, the preprocessor runs first.