The computer doesn't read C directly
A computer only understands machine code: long lists of numbers. C is written in words that people can read. So before a C program can run, it must be translated.
The program that does this translation is called a compiler.
Think of it like this: A compiler is like a translator. You write a letter in English (your C code), the translator turns it into the language of the reader (machine code), and then the reader can follow it.
The three steps
- Write your code in a file that ends in
.c, for examplehello.c. - Compile it. The compiler checks your code and turns it into a program.
- Run the program and see what it prints.
If you make a mistake, the compiler stops at step 2 and tells you which line is wrong. That is normal – every programmer sees these messages every day!
Option 1: Run C right here in your browser
Every module of this course ends with challenges. Each challenge has a code editor and a Run button, so you can write and run C straight away, without installing anything. This is the easiest way to start.
Tip: The browser editor uses a small, simple C runner. It runs all the everyday C in this course. A few advanced examples are marked "on your own computer with gcc": those need a full compiler.
Option 2: Run C on your own computer
Later, you may want a real compiler on your own computer. The most popular one is called gcc.
- Linux: gcc is usually already installed. If not, run
sudo apt install gcc. - macOS: run
xcode-select --installin the Terminal. - Windows: install a free tool such as Code::Blocks or MSYS2, which include gcc.
Then compile and run your program in a terminal:
gcc hello.c -o hello
./hellogcc hello.ccompiles the filehello.c.-o hellomeans "call the finished programhello"../helloruns it.
Remember: Write → Compile → Run. The compiler turns your C code into a program the computer can run.