This cheatsheet provides a curated collection of C and C++ code snippets covering modern language standards, system programming, and development tools. From basic syntax to advanced features like coroutines, templates, and memory management, each example is designed to be clear, practical, and ready to use. All code is tested and compiles cleanly, so you can focus on learning and adapting rather than debugging reference material.
Core C language features from C11 to C23, including memory management, preprocessor macros, GNU extensions, and build systems.
Modern C++ features from C++11 to C++23. Covers resource management with RAII and smart pointers, generic programming with templates and concepts, functional patterns with lambdas, compile-time computation with constexpr, and asynchronous programming with coroutines.
- C++ Basics
- Resource Management
- String
- Container
- Iterator
- Template
- Casting
- Constexpr
- Lambda
- Concepts
- Requires
- Time
- Smart Pointers
- Return Value Optimization
- Algorithm
- Coroutine
- Modules
- CMake
POSIX system programming covering process management, file I/O, signals, network sockets, threading, and inter-process communication.
GPU programming with NVIDIA CUDA. Covers kernel basics, memory hierarchy, cooperative groups, memory visibility, asynchronous pipelines, and multi-GPU communication.
- CUDA Basics
- CUDA C++ (libcu++)
- Thrust
- Cooperative Groups
- Memory Visibility
- Pipelines
- GPU-GPU Communication
- Hardware Topology
Command-line tools and shell scripting for system administration, networking, and hardware inspection.
Tools for debugging, memory analysis, and performance profiling of C/C++ and CUDA applications.
Rust programming guide for C++ developers. Maps C++ concepts to Rust equivalents with side-by-side code comparisons covering ownership, traits, error handling, smart pointers, and concurrency.