Skip to main content
Integer promotion is the implicit conversion of integer types with a conversion rank lower than int to either int or unsigned int before an operation is performed on them. This mechanism ensures that arithmetic and bitwise operations are executed at the CPU’s natural word size, aligning with the C standard’s execution model.

The Value Preservation Rule

The C standard dictates how these smaller types are promoted based on a concept called value preservation (C11 Standard, Section 6.3.1.1):
  1. If an int can represent all possible values of the original type, the value is promoted to int.
  2. If an int cannot represent all possible values of the original type, the value is promoted to unsigned int.
Because a standard int is typically 32 bits and types like char (8 bits) and short (16 bits) are smaller, they almost universally promote to a signed int, regardless of whether the original type was signed or unsigned.

Affected Types

Integer promotion applies specifically to types with an integer conversion rank lesser than the rank of int:
  • char, signed char, unsigned char
  • short, unsigned short
  • _Bool (a fundamental unsigned integer type)
  • Integer bit-fields
  • Enumeration types (enum)

Triggering Contexts

Promotion occurs automatically when the affected types are used as:
  • Operands of unary operators: +, -, ~
  • Operands of binary operators: Arithmetic (+, -, *, /, %), bitwise (&, |, ^, <<, >>), and relational (==, !=, <, >, <=, >=).
  • Arguments to variadic functions: When passed to functions with a variable number of arguments (e.g., ...), smaller integer types undergo default argument promotions.
  • Controlling expression of a switch statement: The integer expression evaluated to determine the execution path explicitly undergoes integer promotion.

Syntax and Behavior Visualization

The following compilable program demonstrates how the type of an expression changes due to integer promotion, evaluated using the sizeof operator, and how promotion alters the behavior of bitwise operations on small unsigned types.
Expected Output:

Distinction from Usual Arithmetic Conversions

Integer promotion is the first step in evaluating expressions. It strictly handles types smaller than int. If an expression involves types equal to or larger than int (e.g., int and long, or int and float), a separate mechanism called the usual arithmetic conversions takes over to find a common type after integer promotions have already been applied to any smaller operands.
Tired of Poor C Skills? Fix That With Deep Grasping!Learn More