For each of the integral types, there is a corresponding unsigned type. Thus, we have unsigned char, unsigned short int, unsigned int, and unsigned long int. There are two differences between the unsigned types and the default, signed types:
65535 + 1 and 5 - 10are actually
(65535 + 1) % (UINT_MAX+1) and (5 - 10) % (UINT_MAX+1)
The guaranteed minimum ranges of the unsigned types are:
unsigned char 0 - 255 unsigned short int 0 - 65535 unsigned int 0 - 65535 unsigned long int 0 - 4294967295
These multiword type names can also be abbreviated. Instead of writing long int, you can write long. Instead of writing short int, you can write short. Instead of writing unsigned int, you can write unsigned. Instead of writing unsigned long int, you can write unsigned long. Instead of writing unsigned short int, you can write unsigned short.
In the absence of the unsigned keyword, types short int, int, and long int are all signed. However, depending on the particular compiler you're using, plain type char might be signed or unsigned. If you need an explicitly signed character type, you can use signed char.
Read sequentially: prev next up top
This page by Steve Summit // Copyright 1996-1999 // mail feedback