ProgrammingLearning library

C programming

Build a precise model of C programs, memory, and compilation. Foundational language rules are separated from compiler extensions; the linked C11 draft is a historical reference rather than a claim about the latest standard.

Beginner15 chapters11 practice questions5 references
Start coursePractise questions

Get an in-app notice when new lessons or practice are added.

15 chapters across 5 modules

Course chapters

Explore all 15 chapters in any order. Each chapter has learning goals, a practice prompt, and a primary reference; expanded reading pages are linked from their chapter titles.

01 · From source to running code3 chapters
  1. Compile and inspect a program

    • Distinguish preprocessing, compilation, assembly, and linking

    Practice: Compile a greeting with warnings enabled and identify the generated executable.

    Read the primary referenceLesson guide · Ready
  2. Values, conversions, and limits

    • Explain how integer ranges and implicit conversions affect expressions

    Practice: Predict signed and unsigned comparisons, then check each with a small program.

    Read the primary referenceLesson guide · Ready
  3. Branching, loops, and invariants

    • State what remains true at each loop iteration

    Practice: Write a bounded sum and test zero, one, and maximum accepted lengths.

    Read the primary referenceLesson guide · Ready
02 · Functions and data representation3 chapters
  1. Function contracts and headers

    • Distinguish a declaration, definition, parameter, and return value

    Practice: Split a unit converter into a header, implementation, and caller.

    Read the primary referenceLesson guide · Ready
  2. Arrays, bounds, and lifetimes

    Follow valid memory accesses rather than guessing from addresses.

    • Explain why pointer values do not carry array length or extend object lifetime

    Practice: Repair an off-by-one traversal and a function returning an address to an expired local.

    Read the primary referenceExpanded reading · Ready
  3. Strings and explicit capacity

    • Track the terminator and available capacity of a character buffer

    Practice: Read a bounded line, detect truncation, and test the empty string.

    Read the primary referenceLesson guide · Ready
03 · Memory and ownership3 chapters
  1. Pointers and indirection

    • Trace an address, pointed-to value, and mutation through an alias

    Practice: Draw the objects touched by a swap function and test it.

    Read the primary referenceLesson guide · Ready
  2. Dynamic allocation and cleanup

    • Assign a clear owner to every allocated region

    Practice: Implement a growable integer buffer with an allocation-failure path.

    Read the primary referenceLesson guide · Ready
  3. Structs and representation

    • Group related fields without assuming portable padding or byte layout

    Practice: Model a reading record and serialize its fields explicitly.

    Read the primary referenceLesson guide · Ready
04 · Files and interfaces3 chapters
  1. File operations and errors

    • Check open, read, write, and close outcomes deliberately

    Practice: Count records in a text file and report an unreadable input.

    Read the primary referenceLesson guide · Ready
  2. Translation units and build steps

    • Explain how headers and separate compilation affect a change

    Practice: Build a three-file program and rebuild only the changed implementation.

    Read the primary referenceLesson guide · Ready
  3. Undefined behavior and portability

    • Separate defined, unspecified, implementation-defined, and undefined behavior

    Practice: Classify example expressions and replace two nonportable assumptions.

    Read the primary referenceLesson guide · Ready
05 · Debugging a practical utility3 chapters
  1. Warnings and sanitizers

    • Use diagnostics as evidence while recognizing their coverage limits

    Practice: Run a deliberately faulty buffer example under available sanitizers and explain the report.

    Read the primary referenceLesson guide · Ready
  2. Memory leak investigation

    • Trace the ownership path behind a leaked allocation

    Practice: Find and fix a missing cleanup path using a local memory checker.

    Read the primary referenceLesson guide · Ready
  3. Build a bounded text analyzer

    • Combine parsing, ownership, and file errors into a testable utility

    Practice: Implement line and word counts with documented input limits and regression cases.

    Read the primary referenceLesson guide · Ready

Learn it. Check it. Try again.

11 original questions with worked explanations and source references. Filter by difficulty, revisit mistakes, and save your attempt as you go.

Open C programming practice

Books & references

Free reading at the publisher or author’s site. External materials keep their own licenses.