C

A small, fast systems language that shows you how computers really work.

C is a compact, compiled language used to write operating systems, embedded software, and the runtimes of many other languages, including Python. Learning it teaches you how memory, pointers and compilation work underneath higher-level languages.

  • Intermediate
  • 12 lessons
Not started yet
Start lesson 1

Lessons

  1. Hello, World!Write, compile and run your first C program, and see the basic shape every C program shares.
  2. Variables & Data TypesLearn C's basic data types, how big they are, and why you should always initialize variables before using them.
  3. Control FlowLearn if/else, switch and C's loops. Most other languages borrowed this syntax, so it carries over well.
  4. Functions & PointersLearn how to write functions and get a first look at pointers, which C uses to let functions change data they are given.
  5. Arrays & StringsLearn how C stores arrays and strings. A C string is just an array of characters ending in a null byte (\0), and knowing that helps you avoid common bugs.
  6. StructsLearn to group related data into structs, which C uses where other languages would use objects.
  7. Mini Project: Number Guessing GamePut the earlier lessons together to build a small interactive number guessing game.
  8. PointersLearn what a pointer is: a variable that holds a memory address. Arrays, strings, structs passed to functions and dynamic memory all rely on the same pointer rules.
  9. Dynamic MemoryLearn to allocate memory at runtime with malloc, so data can outlive a function and be sized on the fly, and how to free it again when you are done.
  10. File I/OLearn to open, read, write and close files with C's FILE streams, and how to check for errors along the way.
  11. The Preprocessor & Multi-File ProgramsLearn what the preprocessor does before compilation, and how to split a program across several files using headers.
  12. C CheatsheetPointers, memory, strings, and structs on one page.

Install it on your own computer

C needs a compiler. GCC and Clang are the two most common. They are easy to install on Linux and macOS, and on Windows there are a few good options, shown below.

Bash
# Option 1: MSYS2 + GCC (recommended for Windows dev)
# Download MSYS2 from msys2.org
# In the MSYS2 terminal:
pacman -S mingw-w64-ucrt-x86_64-gcc

# Option 2: Visual Studio (installs MSVC compiler)
# Download Visual Studio Community (free)
# Select "Desktop development with C++"

# Option 3: WSL2 + Ubuntu (best experience)
wsl --install
# Then in WSL: sudo apt install gcc

# Verify (in the appropriate terminal):
gcc --version

What people build with C

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Program operating systems and embedded devices
  • Write drivers, runtimes, and language interpreters
  • Build portable low-level libraries
  • Control memory and hardware directly

Projects to try

  1. CLI text utility
  2. Arena allocator
  3. Tiny shell
  4. Microcontroller weather station

Common tools and packages

GCCClangCMakeMesonGDBValgrindUnity Testlibcurl

Well-known software

Linux kernelGitSQLiteCPythonRedisVim