Lesson 117 +10 XP

C Cheatsheet: Data Types

Cheatsheet: Core Data Types

The tables you keep Googling, in one place.

Integers

TypeTypical sizeRange
int4 bytes~ -2.1 billion to +2.1 billion
char1 byte-128 to 127
short2 bytes~ -32,768 to 32,767
long4 or 8 bytesplatform dependent

Floats

TypeSizeWhat it's for
float4small decimals
double8default, precise

Note

int may give an easy breakdown across platforms; use <stdint.h> for exact sizes (int32_t, uint8_t) when it matters.

TL;DR

  • int = 4 typical. char = 1. double = 8.
  • Ranges vary by platform.
  • Use <stdint.h> types for guaranteed sizes.