All integer sizes are compiler-dependent.
Integers are int
, which is short. In the Old Days, it would be
-32768..32767. Now an int
is usually 32-bit.
If an int should be long, then declare it long int
, or long
for short.
If you want unsigned, then declare unsigned
. Unsigned longs are unsigned long
.
The postfix U
is added for unsigned literals, and L
for long literals.
#define INT8_MAX 127 #define INT16_MAX 32767 #define INT32_MAX 2147483647 #define INT64_MAX 9223372036854775807LL #define UINT8_MAX 255 #define UINT16_MAX 65535 #define UINT32_MAX 4294967295U #define UINT64_MAX 18446744073709551615ULLTOC | Prev | Next