C Programming

C Programming

The systems language behind operating systems and most other languages' runtimes -- from the compile-link-run model through pointers, dynamic memory, and undefined-behavior pitfalls.

intermediate12 lessons4 modules6h total

Who it's for

Learners with some prior programming experience who want to understand manual memory management and how software runs closer to the machine.

What you'll be able to do

  • Read and predict the behavior of real C programs covering variables, control flow, functions, and arrays
  • Explain how pointers, pointer arithmetic, and malloc/free work, and why C requires manual memory management
  • Identify common undefined-behavior pitfalls (buffer overflows, use-after-free, uninitialized variables) in a piece of C code

Not started — 12 lessons, no account required.

Start this course

Practice this course →Add to a study plan →Interview questions

C Fundamentals

The compile-link-run model, variables and format specifiers, and control flow.

  1. Introduction to C and the Compile-Link-Run Model

    What C is, why it still matters, and how source becomes a running program.

    15 min
  2. Variables, Types, and printf/scanf Format Specifiers

    C's basic types, declaring variables, and the format specifiers printf and scanf both depend on.

    18 min
  3. Control Flow: if, for, while, and switch

    C's four control-flow keywords, and the switch fallthrough behavior to watch for.

    18 min

Functions & Arrays

The stack, arrays, string handling, and multi-dimensional arrays.

  1. Functions and the Stack

    Declaring functions, and why C always passes arguments by value.

    18 min
  2. Arrays and String Handling

    Fixed-size arrays, and why a C string is really just a null-terminated char array.

    20 min
  3. Multi-Dimensional Arrays

    Declaring and iterating over a two-dimensional array with nested loops.

    18 min

Pointers & Memory

Pointers, pointer arithmetic, and dynamic memory with malloc/free.

  1. Pointers and the & and * Operators

    What a pointer actually stores, and how & and * relate a pointer to the variable it points to.

    20 min
  2. Pointer Arithmetic and Arrays as Pointers

    How array indexing and pointer arithmetic are really the same operation underneath.

    20 min
  3. Dynamic Memory with malloc and free

    Allocating heap memory at runtime, and the leak/dangling-pointer risks of managing it yourself.

    22 min

Structs & Program Structure

Structs and typedef, multi-file compilation, and undefined-behavior pitfalls.

  1. Structs and typedef

    Grouping related fields with struct, and giving struct types a clean name with typedef.

    18 min
  2. Header Files and Multi-File Compilation

    Splitting a program across .h and .c files, and why #include guards matter.

    18 min
  3. Common Undefined-Behavior Pitfalls

    Buffer overflows, use-after-free, and uninitialized variables -- and the defensive habits that avoid them.

    22 min

Where to go next

Optional -- these build well on what you just learned, but any course can come next.