short, long, signed, unsigned Keywords

Keyword Index

Type modifiers.

A type modifier alters the meaning of the base type to yield a new type. Each of these type modifiers can be applied to the base type int. The modifiers signed and unsigned can be applied to the base type char. In addition, long can be applied to double.

When the base type is omitted from a declaration, int is assumed. For example,

long x;                 // 'int' is implied
unsigned char ch;
signed int i;           // 'signed' is default
unsigned long int l;    // 'int' is accepted, but not needed
In this implementation of the compiler, the valid range of valid data types is as listed in the following table:
short int              -32768 to 32767
long int               -2147483648 to 2147483647
signed char            -128 to 127
signed int             -32768 to 32767 (signed is default)
                       [or -2147483648 to 2147483647 if '-mnoshort' is given]
signed short int       -32768 to 32767
signed long int        -2147483648 to 2147483647
unsigned char          0 to 255
unsigned int           0 to 65535
                       [or 0 to 4294967295 if '-mnoshort' is given]
unsigned short int     0 to 65535
unsigned long int      0 to 4294967295
Note: GNU C extends the long keyword to allow double-long integers (64-bit integers in this implementation), so they have range from -9223372036854775808 to 9223372036854775807 if signed, or from 0 to 18446744073709551615 if unsigned.