Skip to content

Comprehensive C Language Tutorial

If you are planning to learn or revisit C for any reason, and find the C crash course in the parent directory too fast-paced, consider this tutorial instead. It is more detailed and gradual than the crash course, and you can still pick and choose topics based on your interests.

Fundamentals

#ArticleDescription
01Program Structure and Compilation BasicsBasic structure of C programs, the four stages of compilation, header file mechanisms, and basic I/O
02AData Type Basics: Integers and MemoryInteger family, signed vs. unsigned, fixed-width types, and sizeof
02BFloating-Point, Characters, const, and Type ConversionFloating-point precision, character encoding, the const qualifier, and implicit type conversion
03AOperator Basics: Making Data MoveArithmetic, relational, and logical operators, short-circuit evaluation, and assignment operators
03BBitwise Operations and Evaluation OrderBitwise operations, shift caveats, precedence traps, and sequence points
04Control Flow: Teaching Programs to Choose and RepeatConditional branching, loops, switch fall-through, and the state machine pattern
05Function Basics and Parameter PassingFunction declaration/definition/calling, pass-by-value, pointer parameters, and recursion
06Scope and Storage ClassesScope rules, storage classes, linkage, and the three uses of static
07APointer Essentials: The World of AddressesMemory model, address-of and dereference operators, pointer arithmetic, and distance calculation
07BPointers, Arrays, const, and Null PointersArray-to-pointer decay, const and pointer combinations, NULL, and wild pointers
08AMulti-Level Pointers and Declaration ReadingMulti-level pointer memory models, arrays of pointers vs. pointers to arrays, and cdecl reading rules
08Brestrict, Incomplete Types, and Struct Pointersrestrict optimization, forward declarations, and the opaque pointer pattern
09Function Pointers and the Callback PatternFunction pointer declaration and usage, the callback pattern, and event-driven programming
10Arrays Deep DiveMemory layout, multi-dimensional arrays, variable-length arrays, and their relationship with pointers
11C Strings and Buffer Safety\0 termination model, core string.h functions, and buffer overflow prevention
12Structs and Memory AlignmentStruct definition, alignment padding rules, and flexible array members
13Unions, Enums, Bit Fields, and typedefType punning, hardware register mapping, and comparison with C++ type-safe alternatives
14Dynamic Memory Managementmalloc/calloc/realloc/free, common memory errors, and debugging
15Preprocessor and Multi-File ProjectsMacros, conditional compilation, header guards, and modular multi-file projects
16File I/O and Standard Library OverviewFile reading and writing, formatted I/O, and command-line argument processing

Advanced Topics

Advanced topics are located in the advanced_feature/ subdirectory, covering more in-depth subjects:

#ArticleDescription
01ARM Architecture and Structure FundamentalsARM Cortex-M instruction set, registers, exception vector tables, and processor modes
02Cache Mechanisms and Memory HierarchyCache lines, mapping strategies, the MESI protocol, and cache-friendly programming
03C Language Traps and Common ErrorsSyntax and semantic traps, compiler behavior, and standard specification analysis
04Implementing OOP in CSimulating classes with structs and function pointers, encapsulation, inheritance, and polymorphism
05Building a Dynamic Array from ScratchType-safe dynamic array library, memory resizing, and API design
06Building a Singly Linked List from ScratchInsertion, deletion, and search algorithms, along with sentinel node techniques
07Embedded C Programming PatternsRegister access, volatile, interrupt safety, and peripheral abstraction layers
08Building Reusable C CodeModular design, opaque pointers, and platform abstraction layers

Built with VitePress