C · Learn

The C curriculum

The small, portable language beneath most operating systems and runtimes. Teaches memory, pointers and how programs really execute. This path has 14 lessons in reading order, from the basics to the ideas that come up in real code, with a runnable example in every lesson.

lessons
14 lessons
hours of reading
2.2 hours of reading
exercises to practise
0 exercises to practise

Beginner

7 lessons · about 60 minutes of reading, plus practice.

  1. C Syntax and Your First ProgramThe parts of a C program: #include, int main(void), statements, braces, comments and printf, plus how gcc turns the source file into a program you can run.8 min
  2. Variables and Types in CDeclaring C variables and choosing types: int, long, double, char and bool, sizeof, why uninitialised variables hold garbage, and printf and scanf specifiers.9 min
  3. Operators in CC arithmetic, comparison, logical, assignment and increment operators: why 7 / 2 is 3, how % behaves, what comparisons return, precedence and = versus ==.9 min
  4. Conditions in C: if, else and switchHow C chooses between branches with if, else if, else and switch: what counts as true, combining tests with && and ||, and why each switch case ends with break.9 min
  5. Loops in C: for, while and do-whileThe three C loops and when each fits: how a for loop's three parts run, reading input until it ends with while and scanf, and using break and continue safely.9 min
  6. Functions in CHow to define and call C functions: prototypes before the first call, arguments copied by value, void functions, early returns and local variables.10 min
  7. Arrays in CHow C arrays store same-typed values by zero-based index: initialiser lists, the sizeof length idiom, passing arrays to functions and out-of-range dangers.10 min

Intermediate

4 lessons · about 40 minutes of reading, plus practice.

  1. Strings in CHow C stores text as null-terminated char arrays, reads a line safely with fgets, and copies, joins, compares and searches text with the string.h functions.9 min
  2. Pointers in CWhat a C pointer is, how & and * work, why functions take addresses to change their caller's variables, and how pointer arithmetic walks an array.10 min
  3. Structures in CHow a C struct bundles related values into one record, how to initialise, copy and pass structs to functions, and when to use -> instead of the dot.9 min
  4. Dynamic Memory in CRequesting memory at run time in C with malloc, calloc and realloc, checking for NULL, sizing allocations correctly, and freeing every block exactly once.10 min

Advanced

3 lessons · about 30 minutes of reading, plus practice.

  1. File Handling in CReading and writing files in C through FILE pointers: open modes, fgets line by line, fscanf for records, fprintf output and the error checks that matter.9 min
  2. Sorting and Searching in CLinear and binary search, insertion sort by hand, and the C library's qsort and bsearch with comparison functions, applied to arrays of ints and structs.10 min
  3. Recursion in CHow recursive functions work in C: base and recursive cases, what happens on the call stack, digit and array recursion, and merge sort as divide and conquer.10 min