Skip to main content

C

These notes cover C through the scope of Kernighan and Ritchie's The C Programming Language, second edition: the tutorial core, the expression and type system, control flow, functions, pointers, structures, input/output, the UNIX interface, the ANSI standard library, and the gap between K&R-era style and modern C practice.

C is a small language with unusually direct access to representation. Arrays are contiguous storage, strings are null-terminated character arrays, pointers are typed addresses, and much of the standard library is built out of explicit buffers, status returns, and caller-managed storage. That directness is why K&R can move quickly from "hello, world" to sorting lines, parsing declarations, building hash tables, walking directories, and sketching an allocator.

The pages emphasize K&R idioms: pointer-based traversal, compact stream filters, explicit prototypes, small functions, file-scope static state, careful use of macros, and precise notes on undefined or implementation-defined behavior. The examples are written in modern prototype style while preserving the book's model of how C programs are shaped.

  1. Tutorial Introduction
  2. Types, Operators, and Expressions
  3. Control Flow
  4. Functions and Program Structure
  5. Preprocessor and Separate Compilation
  6. Pointers, Addresses, and Arrays
  7. Strings, Pointer Arrays, and Command-Line Arguments
  8. Function Pointers and Complex Declarations
  9. Structures, Typedef, Unions, and Bit Fields
  10. Linked Structures and Hash Tables
  11. Standard I/O and Formatted I/O
  12. File Access and Error Handling
  13. Unix System Interface
  14. Storage Allocation
  15. Standard Library Reference
  16. Modern C Considerations