Reference and Selective Reading
You do not need to read the source books front-to-back for this module. Use the concept pages and practice pages first. Open these local chunks only when you need alternate exposition, more worked examples, or a deeper exercise lane.
Source Roles
| Source | Role | Why it is here |
|---|---|---|
| The C Programming Language (K&R) | Primary teaching source | Best operational explanations of pointers, arrays, structs, and small allocators |
| Computer Organization and Design (Patterson & Hennessy) | Primary teaching source | Strongest treatment of signed numbers, IEEE 754, and calling conventions |
| CODE (Petzold) | Selective first-principles support | Unmatched for "why is memory a byte array?" intuition |
| SICP | Peripheral | Rarely needed for this module; see semester project work |
| CSAPP | Local support | Excellent companion for machine-level representation and memory behavior alongside K&R and Patterson |
Read Only If Stuck
Cluster 1: Bits, Bytes, and Representation
- K&R: Bitwise Operators
- K&R: Type Conversions
- CODE: Bit by Bit by Bit
- CODE: Bit by Bit by Bit (Part 2)
- CODE: Bytes and Hexadecimal
- CODE: Bytes and Hexadecimal (Part 2)
- CODE: But What About Subtraction
- CODE: But What About Subtraction (Part 2)
- CODE: But What About Subtraction (Part 3)
- CODE: Floating-Point Approximation
- COD: Signed and Unsigned Numbers
- COD: Signed and Unsigned Numbers (Part 2)
- COD: Floating Point
- COD: Floating Point (Part 2)
- COD: Floating Point (Part 3)
Cluster 2: Pointers and Addresses
- K&R: Pointers and Addresses
- K&R: Pointers and Function Arguments
- K&R: Pointers and Arrays
- K&R: Address Arithmetic
- K&R: Character Pointers and Functions
- K&R: Pointer Arrays, Pointers to Pointers
- K&R: Multi-Dimensional Arrays
- K&R: Command-Line Arguments
- K&R: Pointers to Functions
- K&R: Complicated Declarations
- COD: Arrays versus Pointers
Cluster 3: Memory Layout
- K&R: Example - A Storage Allocator
- K&R: Self-Referential Structures
- COD: Supporting Procedures in Computer Hardware
- COD: Supporting Procedures (Part 2)
- COD: Supporting Procedures (Part 3)
- COD: A C Sort Example
- COD: Translating and Starting a Program (Part 4)
- COD: Translating and Starting a Program (Part 5)
- CODE: An Assemblage of Memory
- CODE: An Assemblage of Memory (Part 2)
- CODE: An Assemblage of Memory (Part 3)
- CODE: An Assemblage of Memory (Part 4)
Cluster 4: Memory Errors and Safety
- Clang AddressSanitizer
- Clang UndefinedBehaviorSanitizer
- Clang LeakSanitizer
- Valgrind Memcheck manual
- Clang Static Analyzer
- GCC
-fanalyzer - CWE-121: Stack-based Buffer Overflow
- CWE-416: Use After Free
- CWE-415: Double Free
- CWE-787: Out-of-bounds Write
- Smashing the Stack for Fun and Profit (Aleph One)
Cluster 5: Structs, Alignment, and Endianness
- K&R: Basics of Structures
- K&R: Structures and Functions
- K&R: Arrays of Structures
- K&R: Pointers to Structures
- K&R: typedef
- K&R: Unions
- K&R: Bit Fields
- COD: MIPS Addressing for 32-Bit Immediates and Addresses
- The Lost Art of Structure Packing (Raymond)
- Bit Twiddling Hacks (Anderson)
- Beej's Guide to Network Programming: Byte order
Optional Deep Dive
- What Every Programmer Should Know About Memory (Drepper) - long memory-hierarchy paper; most useful later in Module 3 but worth knowing about here.
- What Every Computer Scientist Should Know About Floating-Point Arithmetic (Goldberg) - deep dive for the IEEE 754 concept page.
- System V AMD64 ABI - authoritative calling-convention document.
- cppreference: C language reference - single best day-to-day reference.
- GNU C Library: Memory Allocation -
mallocfamily semantics in detail. - Linux man-pages online -
malloc(3),mmap(2),proc(5),htonl(3), and friends.
Concept-to-Source Map
| Primary concept | Best source if stuck | Why this source |
|---|---|---|
| Binary, hex, and the byte | CODE: Bit by Bit by Bit | Best first-principles explanation |
| Integer representations and overflow | COD: Signed and Unsigned Numbers | Tightest treatment of two's complement |
| IEEE 754 floating point | COD: Floating Point | Single-chapter format overview |
Pointers, &, * | K&R: Pointers and Addresses | Canonical introduction |
| Pointer arithmetic | K&R: Address Arithmetic | The section that makes it click |
| Pointer-to-pointer and function pointers | K&R: Pointer Arrays, Pointers to Pointers | Canonical via argv and qsort |
| Virtual address space | COD: Translating and Starting a Program (Part 5) | Best single-chapter segment summary |
| Stack frames and calling conventions | COD: Supporting Procedures | Best operational explanation |
| Heap allocation | K&R: Example - A Storage Allocator | Classic small allocator as reference |
| Buffer overflows | CWE-121: Stack-based Buffer Overflow | Authoritative taxonomy and examples |
| Use-after-free, double-free | CWE-416 and CWE-415 | Authoritative entries |
| Detection tools | AddressSanitizer and Valgrind Memcheck | Official documentation |
| Struct layout and alignment | The Lost Art of Structure Packing (Raymond) | Best short treatment |
| Endianness and wire formats | Beej's Guide: Byte Order | Accessible introduction with code |
| Bit manipulation idioms | Bit Twiddling Hacks (Anderson) | Single best idioms collection |