Hi,
In the K&R C II,
Code:
The type of an integer constant depends on its form, value and suffix.
(See Par.A.4 for a discussion of types). If it is unsuffixed and decimal, it
has the first of these types in which its value can be represented: int,
long int, unsigned long int. If it is unsuffixed, octal or hexadecimal, it
has the first possible of these types: int, unsigned int, long int,
unsigned long int. If it is suffixed by u or U, then unsigned int, unsigned
long int. If it is suffixed by l or L, then long int, unsigned long int. If an
integer constant is suffixed by UL, it is unsigned long.
compared to int, unsigned int can represent bigger positive numbers, just like unsigned long vs. long. If int is assigned to 8 bits, then its range for positive number is [0, +127], while unsigned int is [0, +255]. An integer constant like 200 can be represented as unsigned int, which doesn't have to be long (which maybe has bigger bits than int).
Just like unsuffixed octal and hex integer constants, they take an order int->unsigned int->long->unsigned log. I think this is more reasonable, don't understand why unsuffixed decimal integer skip unsigned int. Could anyone please explain it to me?
THANKS!!