C Mastery / Index

C Mastery

A dependency-ordered curriculum that takes a working programmer to expert C: systems, embedded, compilers, networking, security, and performance.

Chapters

How to Read This CurriculumProgram Structure, Translation Units, and the First ProgramThe C Landscape: What Is C, What It Is NotObjects, Values, and the Abstract MachineTypes Part 1: Integer Types and RepresentationsTypes Part 2: Floating-Point and IEEE 754Types Part 3: void, Pointer Types, and Type System FoundationsDeclarations, Definitions, and IdentifiersScope, Storage Duration, and LifetimeExpressions and EvaluationOperators: Arithmetic, Comparison, LogicalOperators: Bitwise and ShiftOperators: Assignment, Compound Assignment, Increment/DecrementOperators: sizeof, _Alignof, Cast, Conditional, CommaPrecedence, Associativity, and SequencingConversions: Integer Promotions and Usual Arithmetic ConversionsControl Flow: Selection (if, switch)Control Flow: Iteration (while, do, for) and JumpsFunctions: Declaration, Definition, Parameters, ReturnsRecursion and Function-Call MechanicsPointers Part 1: Addresses, Declaration, DereferencingPointers Part 2: Arithmetic, Comparison, and One-Past-the-EndArrays Part 1: Declaration, Initialization, DecayArrays Part 2: Multidimensional, VLA, Pointer-to-ArrayStrings and the Standard Character FunctionsPointers Part 3: void*, Pointer-to-Pointer, Pointer ArraysPointers Part 4: const, volatile, restrictStructs: Declaration, Access, Padding, AlignmentUnions: Representation, Tagged Unions, Type PunningEnums and TypedefCompound Literals and Designated InitializersFlexible Array Members and Variable-Length ArraysBit-FieldsFunction Pointers and CallbacksVariadic Functions and stdarg.hInline Functions and LinkageLinkage: internal, external, none; extern, staticThe Preprocessor: Includes and Object-Like MacrosThe Preprocessor: Function-Like, Variadic, Stringification, PastingThe Preprocessor: Conditionals, Feature Detection, PragmasMulti-File Programs and HeadersThe Object Model: Bytes, Representation, Effective TypeAlignment, Padding, and Object LayoutAliasing and Strict AliasingPointer Provenance and Pointer ValidityIndeterminate Values and Trap RepresentationsUndefined, Unspecified, and Implementation-Defined BehaviorUB Catalog: The Important CasesStandard Library Overview and Headersstdio.h: Streams, Files, Formatted I/Ostdlib.h: Conversion, Allocation, Environmentstring.h: String and Memory Functions in Depthctype.h, stdint.h, stddef.h, stdbool.h, limits.h, float.hmath.h: Floating-Point Functionserrno.h, assert.h, and Error-Handling Patternstime.h: Calendar and Processor Timesignal.h and setjmp.hlocale.h, wchar.h, wctype.h: Locale and Wide Charactersinttypes.h and Extended Integer Typesstdatomic.h and threads.h: ISO C Concurrency PrimitivesThe C Memory Model: Stack, Heap, Static, Thread-Localmalloc, calloc, realloc, freeOwnership, Lifetime, Leaks, and Dangling PointersAllocation Failure, Fragmentation, and AlignmentCustom Allocators: Pools, Arenas, SlabsVirtual Memory, Pages, Caches, and Hardware MemoryThe Compilation Pipeline: Source to ExecutableSymbol Tables, Relocations, and SectionsStatic and Dynamic Linking, Shared LibrariesABI and Calling ConventionsExecutable Formats: ELF, Mach-O, PECompilers: GCC, Clang, MSVCBuild Systems: Make, CMake, Ninja, MesonCompiler and Linker FlagsCross Compilation and ToolchainsDebug vs. Release BuildsDebugging with GDB and LLDBCore Dumps, Debug Symbols, DWARFSanitizers: ASan, UBSan, TSan, MSanValgrind and Static AnalysisDebugging Optimized BuildsHow Optimizers Work: O0–O3, Inlining, DCEUB-Based Optimization and Compiler AssumptionsLTO, PGO, VectorizationCPU Registers, PC, SP, Status, Instruction ExecutionStack Frames and Calling ConventionsCaches, Cache Lines, TLB, MMU, MPUEndianness and Alignment at the Hardware LevelArchitectures: x86, x86-64, ARM, ARM64, RISC-VHow C Becomes Assembly: Case StudiesInline Assembly, Intrinsics, and BarriersData Structure Foundations and ComplexityDynamic Arrays and StacksLinked Lists: Singly, Doubly, CircularQueues, Deques, Ring BuffersHash Tables and Hash MapsBinary Trees and BSTsBalanced Trees: AVL and Red-BlackHeaps and Priority QueuesTries and GraphsBitsets, Bitmaps, and Memory PoolsSearching and SortingRecursion, Dynamic Programming, Greedy, BacktrackingGraph Algorithms: BFS, DFS, Dijkstra, A*, Topological SortUnion-Find, String and Bit AlgorithmsProfiling and BenchmarkingCache and Memory Locality, Data Layout (AoS/SoA)Branch Prediction and Memory BandwidthSIMD: SSE, AVX, NEON, SVE, IntrinsicsFalse Sharing and Allocation OverheadProcesses, Threads, and Shared StateRace Conditions and Data RacesMutexes, Semaphores, Condition VariablesRead/Write Locks, Spinlocks, Critical SectionsAtomics and the C Memory ModelCAS, Acquire/Release, Relaxed, Sequential ConsistencyFences and Memory BarriersLock-Free and Wait-Free ProgrammingDeadlock, Livelock, Starvation, Priority InversionFalse Sharing in Concurrent Programs