Cheatsheets
C
Types, pointers & memory, control flow, the preprocessor, and bit operations.
Visualize
C — the call stack & the heap (3D)
Step through a program: stack frames push/pop while a malloc'd heap block outlives its function — then dangles after free().
CPU cache — the memory hierarchy (3D)
Each level down is ~10× slower but bigger; caches exploit temporal & spatial locality, so a repeat access is fast.
25 entries
Types & declarations7
int / char / float / doubleBasic types
uint8_t / int32_t (stdint.h)Fixed-width integers (embedded)
const / static / externRead-only / file-scope / external linkage
volatileTell the compiler a value can change outside this code path.
struct Point { int x, y; };Aggregate type
typedef struct {...} Foo;Alias a type
enum { LOW, HIGH };Enumerated constants
Pointers & memory6
int *p = &x;Pointer holds an address; *p reads/writes the target.
arr[i] == *(arr + i)Array/pointer duality
malloc / calloc / freeHeap allocation — every malloc needs exactly one free.
p->fieldMember via pointer (= (*p).field)
void *Generic pointer
sizeof(x)Size in bytes (compile-time)
Control & functions5
if / else / switchBranching
for / while / do-whileLoops
int add(int a, int b) { return a + b; }Function definition
static inlineInternal, inlined helper
return / break / continueFlow control
Preprocessor & bit ops7
#include <stdio.h>Include a header
#define PIN 5Macro constant
#ifdef / #ifndef / #endifConditional compilation (include guards)
x |= (1 << n)Recipe: set / clear / toggle / read a register bit.
x &= ~(1 << n)Clear bit n
x ^= (1 << n)Toggle bit n
(x >> n) & 1Read bit n