Next: Unsigned integer types, Up: Primitive types [Contents]
There are five primitive signed integer types:
int
, int8
, int16
, int32
and int64
.
Except for int
,
the width in bits of each of these is given by the numeric suffix in its name.
The width in bits of int
is implementation defined,
but must be at least 32-bits.
All signed integer types use two’s-complement representation. Their width must be equal to the width of the corresponding unsigned type.
Values of the type int8
must be in the range
-128 (-(2^{8 - 1})) to 127 (2^{8 - 1} - 1),
both inclusive.
Values of the type int16
must be in the range
-32768 (-(2^{16 - 1})) to 32767 (2^{16 - 1} - 1),
both inclusive.
Values of the type int32
must be in the range
-2147483648 (-(2^{32 - 1}))
to 2147483647 (2^{32 - 1} - 1),
both inclusive.
Values of the type int64
must be in the range
-9223372036854775808 (-(2^{64 - 1}))
to 9223372036854775807 (2^{64 - 1} - 1),
both inclusive.
Values of the type int
must be in the range
to -(2^{N - 1}) to 2^{N - 1} - 1,
both inclusive;
N being the width of int
in bits.