Integer Types

Every integer constant is given a type based on its value and the way it is expressed. You can force any integer constant to type long by appending the letter l or L to the end of the constant; you can force it to be type unsigned by appending u or U to the value. The lowercase letter l can be confused with the digit 1 and should be avoided. Some forms of long integer constants follow:

/* Long decimal constants */
10L
79L

/* Long octal constants */
012L
0115L

/* Long hexadecimal constants */
0xaL or 0xAL
0X4fL or 0x4FL

/* Unsigned long decimal constant */
776745UL
778866LU

The type you assign to a constant depends on the value the constant represents. A constant’s value must be in the range of representable values for its type. A constant’s type determines which conversions are performed when the constant is used in an expression or when the minus sign () is applied. This list summarizes the conversion rules for integer constants.