Integral Types

There are 10 types in C for representing integers.

The range of values that each can represent varies between implementations.

The range of values that each can represent varies between implementations.

There is a guaranteed minimum range that each every C implementation should provide for each type.

nameguaranteedtypical<limits.h>
minmaxminmaxminmax
char (*) -127 127 -128 127 SCHAR_MINSCHAR_MAX
unsigned char 0 255 0 255 UCHAR_MAX
short -32767 32767 -32768 32767 SHRT_MINSHRT_MAX
unsigned short 0 65535 0 65535 USHRT_MAX
int -32767 32767 -2147483648 2147483647 INT_MININT_MAX
unsigned int 0 65535 0 4294967295 UINT_MAX
long -2147483647 2147483647 -2147483647 2147483647 LONG_MINLONG_MAX
unsigned long 0 4294967295 0 4294967295 ULLONG_MAX
long long -9223372036854775807 9223372036854775807 -9223372036854775807 9223372036854775807 LLONG_MINLLONG_MAX
unsigned long long 0 184467444073709551615 0 184467444073709551615 ULLONG_MAX

(*) On some machines the type char is equivalent to unsigned char.

For most purposes use int.

Integers appearing the text of a program are, by default, of type int.

Index