C Cheat Sheet
|
This section documents C23 (ISO/IEC 9899:2024), per ISO/IEC JTC1/SC22/WG14’s freely available working draft N3220, which WG14 documents as differing from the published standard only editorially — the reference these pages are written and verified against. This content was generated with the assistance of AI and should be verified against the WG14 draft and cppreference.com’s C reference before being relied on in production. This section’s bibliography lists the reference material consulted while preparing these pages. |
A single-page, colour-coded summary of the C essentials — compiling with clang -std=c23 -Wall -Wextra,
types and literals, the integer promotions and the conversion traps, operator precedence, control flow and
switch fall-through, functions and variadics, pointers and pointer arithmetic, arrays and strings, structs,
unions, enums and bit-fields, dynamic memory and ownership, storage duration and linkage, the printf/scanf
format table, files and streams, the <string.h>/<ctype.h>/<math.h>/<stdbit.h>/<time.h> essentials,
the preprocessor, _Generic/typeof/auto, threads and atomics, error handling and the undefined-behavior
roll-call, the C23 additions with their compiler support, and the toolchain flags — handy for quick
memorization or as a printable desk reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Getting started — Getting Started and Program Structure.
Language fundamentals — Lexical Structure and Style, Basic Types and Values, Constants, Enumerations and Initialization, Operators and Expressions, Control Flow, Functions, Arrays and Strings, and Structures, Unions and Type Aliases.
Pointers and memory — Pointers, Memory Model and Alignment, Dynamic Memory Allocation, and Storage Duration, Scope and Linkage.
Preprocessor and generic programming — Preprocessor and Macros and Type-Generic Programming.
Standard library — Standard Library Overview, Numbers and Math, Input, Output and Files, Strings and Text Processing, and Dates and Times.
Robustness and performance — Error Handling and Program Failure, Advanced Control Flow, and Performance.
Concurrency — Threads and Atomics and Memory Consistency.
Tooling and standards — Build and Tooling, Testing, and C Standards and C23.