正常
Comprehensive C Language Tutorial
PS: this part of the tutorial is not aimed at absolute beginners. It grew out of the C notes we took back in our embedded-development days, and C was already firmly in hand by the time those notes were written. So if you actually need to learn C from scratch, head over to this repo instead:
The C tutorials here are geared toward people who once learned C but have since forgotten what it looks like.
Fundamentals
Program Structure and Compilation BasicsThe basic structure of a C program, the four-stage compilation pipeline, the header file mechanism, and basic I/OData Type Basics: Integers and MemoryThe integer family, signed vs. unsigned, fixed-width types, and sizeofFloating Point, Characters, const, and Type ConversionFloating-point precision, character encoding, the const qualifier, and implicit type conversionOperator Basics: Making Data MoveArithmetic, relational, and logical operators, short-circuit evaluation, and assignment operatorsBitwise Operations and Evaluation OrderBitwise operations, shifting caveats, precedence traps, and sequence pointsControl Flow: Teaching Programs to Choose and RepeatConditional branches, loops, switch fall-through, and the state machine patternFunction Basics and Parameter PassingFunction declaration/definition/call, pass-by-value, pointer parameters, and recursionScope and Storage ClassesScope rules, storage classes, linkage, and the three uses of staticPointer Basics: The World of AddressesThe memory model, address-of and dereference, pointer arithmetic, and distance computationPointers, Arrays, const, and Null PointersArray-to-pointer decay, combining const with pointers, NULL, and wild pointersMultilevel Pointers and Reading DeclarationsThe memory model of multilevel pointers, array of pointers vs. pointer to array, and reading declarations with cdeclrestrict, Incomplete Types, and Structure Pointersrestrict optimization, forward declarations, and the opaque pointer patternFunction Pointers and the Callback PatternDeclaring and using function pointers, the callback pattern, and event-driven programmingA Deep Dive into ArraysMemory layout, multidimensional arrays, variable-length arrays, and their relationship with pointersC Strings and Buffer SafetyThe \0-terminated model, core string.h functions, and preventing buffer overflowsStructures and Memory AlignmentStruct definitions, alignment and padding rules, and flexible array membersUnions, Enums, Bit Fields, and typedefType punning and hardware register mapping, compared with type-safe C++ alternativesDynamic Memory Managementmalloc/calloc/realloc/free, common memory errors, and debuggingThe Preprocessor and Multi-File ProjectsMacros, conditional compilation, header guards, and modular multi-file projectsFile I/O and Standard Library OverviewFile reading and writing, formatted I/O, and command-line argument handling
Advanced Topics
The advanced topics live in the advanced_feature/ subdirectory and cover more in-depth subjects:
ARM Architecture and System FundamentalsThe ARM Cortex-M instruction set, registers, the exception vector table, and processor modesCache Mechanisms and Memory HierarchyCache lines, mapping strategies, the MESI protocol, and cache-friendly programmingC Pitfalls and Common ErrorsSyntax and semantic traps, compiler behavior, and analysis against the standardImplementing Object-Oriented Programming in CSimulating classes with structs plus function pointers, encapsulation, inheritance, and polymorphismBuilding a Dynamic Array from ScratchA type-safe dynamic array library, growing and shrinking memory, and API designBuilding a Singly Linked ListInsertion, deletion, and search algorithms, plus sentinel node tricksEmbedded C Programming PatternsRegister access, volatile, interrupt safety, and peripheral abstraction layersDesigning Reusable C CodeModular design, opaque pointers, and platform abstraction layers