core Estimated learning time: 12 h

P-3.1 C: Types, Control Flow and Functions

You can write, compile and run a C program using its types, loops, conditionals and functions, and explain what the compiler does and does not check for you.

C is worth learning not because you will write much of it but because it makes explicit everything other languages do quietly. Its type system is thin, its checking is minimal, and its behaviour maps closely onto the machine model from the first module. Read the compiler warnings from the first day and turn them on aggressively, because in C the difference between a warning and a crash is often a few months.

Work through these

  • Types, sizes, and what the compiler will let you get away with

    C types describe how many bytes a value takes and how to read them, and conversions between them happen quietly in places you did not ask for. Knowing the sizes on your machine is the start of predicting that.

    NPTEL: Introduction to Programming in C · Course
  • Conditionals, loops and the traps in each

    The control structures are ordinary, and the traps are famous: an assignment where a comparison was meant, an off-by-one at a boundary, a semicolon that ends a loop body early.

  • Functions, arguments by value, and returning results

    C passes copies of arguments, so a function cannot change a caller's variable without being handed its address. This single fact explains why pointers appear as early as they do.

  • Turn on every warning the compiler offers, and fix all of them

    The compiler already knows about a large share of the mistakes you are about to make and stays quiet by default. Treating warnings as failures from day one is the cheapest habit in this module.

  • Undefined behaviour: what it means that the standard says nothing

    Some mistakes are not errors but situations the language declines to define, which means the compiler may do anything at all including working perfectly until it does not. This is why C demands care rather than cleverness.

Sign in to keep your progress.

Free resources

Links last checked 31 Aug 2026.

Stuck here?

Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.

Checking your session…

Topics shown in module order.