How Computers Run Programs
What a program actually is, why programming languages exist, and how C# code becomes something your computer can run — no code required yet.
Before we write any C#, let's nail the most basic question: what is a program?
A program is a list of instructions that a computer follows one after another, exactly as written. Every game, every app, every website is — at the bottom of everything — a very long list of tiny instructions.
Picture instructions for assembling furniture:
1. Attach panel A to panel B with four screws.
2. Insert shelf C into the slots.
3. Tighten all screws.
Assembly instructions are for a human. A program is instructions for a computer. The crucial difference: a human can improvise when a step is vague. A computer cannot. It does exactly what the instructions say — nothing more, nothing less. If the result is wrong, one of the instructions was wrong.
Deep down, your computer's processor (the CPU) understands only machine code — raw sequences of 1s and 0s like 10011010 11000101. Nobody writes that by hand anymore.
Instead we use programming languages — ways to write instructions in something close to English:
Console.WriteLine("Hello!");Text written in a programming language is called source code. It's designed for humans to read and write — the computer still needs it translated before anything runs. How a language does that translation shapes everything about it, and C#'s approach is one of its biggest strengths.
What is a program?
- AA list of instructions that a computer follows exactly, in order
- BA rough description of what the computer should figure out on its own
- CThe physical chips inside a computer
- DA special kind of text file the computer reads for fun
Here's how your C# source code becomes a running program — a two-step trick very similar to Java's:
Step 1: compile. The C# compiler (run for you by thedotnet tool) checks your whole file for mistakes and translates it into IL — Intermediate Language. IL isn't machine code for one specific CPU; it's a compact, portable instruction format.
Step 2: run. The .NET runtime loads that IL and — just in time, as the program runs — translates it into real machine code for whatever machine it's on: a Windows PC, a Mac, a Linux server.
The payoff: the same compiled program runs on all of them. Modern .NET is fully cross-platform and free.
Three words to remember:
- Source code — the
.csfile you write. - IL — the portable instructions the compiler produces.
- .NET runtime — the engine that runs IL on any device.
The C# compiler translates your source code into ___ (Intermediate Language), which the .NET runtime can run on any supported device.
One more thing before your first program: errors are a normal part of programming.
When your code breaks a rule of the language — a missing semicolon, a misspelled name — the compiler refuses to translate it and prints an error message pointing at the problem. That's not failure; it's the compiler catching mistakes before your program ever runs, which is exactly what you want.
Every professional C# developer reads compiler errors every single day. In this course you'll learn to read them calmly, fix the line, and re-run. That write → compile → fix loop is programming.
Next: what C# actually powers — and if you've ever wanted to make a game, you're going to like the answer.
Why does the compiler refusing to compile broken code actually help you?
- AMistakes get caught before the program runs, with a message pointing at the problem
- BIt deletes the parts of the program that were wrong
- CIt makes the program run faster
- DIt doesn't help — errors mean you should start over