It’s implementation-dependent. The C standard only requires that:
char
has at least 8 bitsshort
has at least 16 bitsint
has at least 16 bitslong
has at least 32 bitslong long
has at least 64 bits (added in 1999)- sizeof(char) ≤ sizeof(short) ≤ sizeof(int) ≤ sizeof(long) ≤ sizeof(long long)
In the 16/32-bit days, the de facto standard was:
int
was the “native” integer size- the other types were the minimum size allowed
However, 64-bit systems generally did not make int
64 bits, which would have created the awkward situation of having three 64-bit types and no 32-bit type. Some compilers expanded long
to 64 bits.