Up to three different sizes of integers can be defined - as shown below.

short int int long int

The first and the third of these can be expressed as:

short long

respectively. By default, all of the above are signed integers. The unsigned counterparts of the three formats are:

unsigned short int unsigned int unsigned long int

and again the 'int' component can be dropped - as shown below.

unsigned short unsigned unsigned long

Irrespective of the machine architecture, it is guaranteed that:

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long).

For current compilers on the 32 bit Intel platform:

sizeof(char) == 1, sizeof(short) == 2, sizeof(int) == 4, sizeof(long) == 4.

That is, a short integer occupies two bytes and integers and long integers occupy four bytes.

An integer constant consists of a sequence of digits and possibly letters. The three formats in which an integer constant may be expressed are:

Decimal | Base 10 |

Hexadecimal | Base 16 |

Octal | Base 8 |

Mention is made of hexadecimal notation in the topic numeric representation. Integer constants of the three supported bases may be distinguished as follows:

- a hexadecimal integer constant begins with 0x (or 0X) and consists of a sequence of characters from the following set {0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f} (case unimportant),
- an octal integer constant begins with a 0 and consists of a sequence of digits from the set {0,1,2,3,4,5,6,7},
- a decimal integer constant begins with a non-zero digit and consists of a sequence of digits.

The type of an integer constant (i.e. int, long, unsigned) depends upon its
form and suffix. Suffixes that may be formed consist of a sequence of zero, one
or two distinct letters taken from the set {u,l}, where 'u' means that the
constant is of *unsigned* type and 'l' means that it is a *long* integer.
Case and order are not significant when forming a suffix (e.g. 1ul
and 1LU both mean unity treated as an unsigned long integer). The following is
true.

- A decimal constant without a suffix is treated as integer if the specified value can be represented within the precision offered by the integer data type, otherwise if the type long integer can be used to represent the constant then that type is chosen, otherwise the constant is of type unsigned long integer.
- The choices (in ascending order of precedence) used to represent unsuffixed octal and hexadecimal constants are int, unsigned int, long int, unsigned long int.
- If the suffix 'u' is applied alone, the constant is either of type unsigned int or unsigned long int, depending on whether it is representable in the first or only the last format (the former format is given precedence).
- If the suffix 'l' is applied alone, the constant is either of type long int or unsigned long int, depending on whether it is representable in the first or only the last format (the former format is given precedence).

As for the character data type, integers can be declared singly, or multiply and in an initialized or an uninitialized state. For example, the following are valid declarations.

int i,j,k; // Three uninitialized integers. unsigned int a = 10; // First digit nonzero implies decimal. unsigned b = a; // Copying one to the other. unsigned c = 0xffffffff; // Initialize in hexadecimal. int d = -1; // And with a negative number. int e = 077; // Initialize in octal because first digit zero. long f = 65537; // On 32 bit Intel long and integer the same. short g = f; // Truncated to zero, because 17th bit first nonzero. short h = -1; // On Intel == 0xffff (2 bytes) int i = h; // Gets sign extended hence = 0xffffffff (on 32 Bit Intel that is). signed char maximum = '/xff'; // Negative 1 actually, because char is signed. short minus_one = maximum; // Again gets sign extended and ends up as -1. int sum = d + e; // Addition of two ints to get another.