Integer Data Types and their Ranges

The number of bytes and the range are directly coupled :

total range ( - and + together ) = 28*bytes

The number of bytes for each data type does depend on the operating system. But most (if not all of them) follow the pattern below. (Use sizeof() to verify)

TypeSize (bytes)Range
short2-32,768 to +32,767
unsigned short20 to 65,535
int4-2,147,483,648 to 2,147,483,647
unsigned int40 to 4,294,967,295
long4-2,147,483,648 to 2,147,483,647
unsigned long40 to 4,294,967,295
long long8-9*10^18 to +9*10^18 (approx)
unsigned long long80 to +18*10^18 (approx)


Send a Note to Zig

Zig Herzog © 2014
hgnherzog@yahoo.com
Last revised: 08/23/13