Skip to content

C Programming Textbook

A free, self-paced textbook in 7 chapters. Read a chapter, then drill it with the 170 companion flashcards using spaced repetition.

7 chapters · 170 cards · Updated

Chapters

  1. 1Pointers and Dynamic Memory

    Pointers are central to C, serving as variables that store the memory address of another value. They are declared with the star operator, as in int *ptr, and the address-of operato...

  2. 2Data Types, Variables, and User-Defined Aggregates

    C's basic data types are intentionally minimal: char (at least 8 bits), int (the natural integer size for the platform), float, double, and long double for floating-point values, p...

  3. 3Arrays, Strings, and Memory Operations

    Arrays in C hold a fixed number of elements of the same type, declared with a compile-time size like int arr[5]. Indexing starts at 0, and unlike some languages C performs no autom...

  4. 4Functions and Control Flow

    C functions consist of a return type, name, and parameter list. A function prototype declares these without a body, allowing the compiler to check call-site argument types and forw...

  5. 5File I/O and Program Termination

    File operations in C begin with fopen, which takes a filename and a mode string. The standard text modes are r, w, and a, while binary variants rb, wb, and so on are required for i...

  6. 6The Preprocessor and Macros

    The C preprocessor runs before compilation and handles directives such as #include, #define, #ifdef, #ifndef, #if, #elif, #else, #endif, and #pragma. Its output is a single transla...

  7. 7Compilation, Linking, and Program Structure

    A C program is built in four stages. The preprocessor resolves directives, expands macros, and includes headers to produce a translation unit. The compiler parses that unit, perfor...

← Back to the C Programming deck