Nearby lessons

1 of 124

C - Overview

A bird's-eye view of the C programming language — what it is, where it is used, how a C program becomes a running program, and the exact order in which you should learn the topics in this tutorial.

What is C?

C is a general-purpose, procedural programming language developed by Dennis Ritchie at Bell Laboratories in 1972. It was created to write the UNIX operating system, and it is still the language of choice whenever a program has to be small, fast, and close to the hardware.

C is compiled, not interpreted: a compiler translates your entire source file into machine code once, and the resulting executable runs directly on the CPU. That is why C programs are dramatically faster than programs written in interpreted languages.

In simple words: C is the language that sits closest to the machine while still being readable by humans. Learn C and you learn how computers actually work.

Why C is called a Middle-Level Language

Languages are often grouped by how far they sit from the hardware. C is unusual because it lives in both worlds:

LevelExamplesWhat you control
Low-levelAssembly, machine codeIndividual CPU instructions and registers
Middle-levelCReadable statements plus direct memory addresses via pointers
High-levelPython, Java, JavaScriptLogic only — memory is managed for you

Pointers, sizeof, and bitwise operators give you low-level power. Functions, loops, and structures give you high-level readability.

Your First Look at a C Program

Every C program has the same skeleton. Read this one before you understand it — you will meet each piece again in its own lesson:

Example03
CCode Cell
1#include <stdio.h> // bring in printf
2 
3int main() // execution always starts here
4{
5 printf("Hello, C!\n"); // print a line of text
6 return 0; // 0 means "finished successfully"
7}
Output
Hello, C!

How C Code Becomes a Program

When you press Run, four separate tools work in sequence. Knowing their names makes error messages far easier to read:

StageToolWhat it does
1. PreprocessingPreprocessorHandles #include and #define, strips comments
2. CompilingCompilerTurns C into assembly; reports syntax errors
3. AssemblingAssemblerTurns assembly into an object file (.o)
4. LinkingLinkerJoins your object file with library code into an .exe
Trainer's Note: A compiler error means your syntax is wrong. A linker error (like "undefined reference to main") means the syntax was fine but a required piece of code was never found. Two different stages, two different fixes.

Where C is Used Today

  • Operating systems — the Linux and Windows kernels are largely C.
  • Embedded systems — washing machines, cars, pacemakers, microcontrollers.
  • Databases — MySQL, PostgreSQL, SQLite, Redis.
  • Language runtimes — CPython, the JVM, and Node.js are written in C/C++.
  • Compilers and tools — GCC itself compiles C with C.

How to Learn C — The Roadmap

Follow the sidebar top to bottom. The order is deliberate: every topic uses only what came before it.

  1. Setup — install a compiler and run your first program.
  2. Basics — comments, keywords, identifiers, variables, data types, input and output.
  3. Operators — arithmetic through bitwise, plus precedence.
  4. Control flowif, switch, and the three loops.
  5. Data collections — arrays and strings.
  6. Functions — split a program into reusable blocks.
  7. Pointers — the topic that unlocks real C.
  8. Custom types — structures, unions, typedef, enum.
  9. Files — make your data survive after the program exits.
Do not skip ahead to pointers. Pointers are only confusing when you are shaky on variables and memory addresses. Master the basics and pointers become easy.
📝 Key Takeaways
  • C is a general-purpose, procedural, compiled language created in 1972.
  • It is called a "middle-level" language: high-level syntax, low-level memory control.
  • Every C program starts executing at main().
  • Source code → preprocessing → compiling → assembling → linking → executable.
  • Almost every modern language (Java, Python, C++, C#) borrows C syntax.

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3