Types & sizeof in C

From the C cheat sheet · Variables & Types · verified Jul 2026

Types & sizeof

C's built-in types and their sizes.

c
// Quick Reference
int i = 42;
long l = 42L;
double d = 3.14;
char c = 'A';
unsigned u = 10;
bool ok = true;   // C23 keyword
💡 In C23, bool/true/false are keywords - older C needed #include <stdbool.h>.
⚡ Type sizes are platform-dependent; use <stdint.h> (int32_t) when the width matters.
📌 Print sizeof (a size_t) with %zu; using %d there is technically wrong.
🟢 unsigned types wrap around on overflow; signed integer overflow is undefined behavior.
typessizeof

More C tasks

Back to the full C cheat sheet