Integer promotion
Integer promotion is the implicit conversion of certain narrow integer operands to int or another suitable integer type before specified operations.
Modern C, Third Edition
Integer promotion is the implicit conversion of a narrow integer type to an integer type before certain C expressions are evaluated.
- How it is used
- Explains how narrow integers participate in arithmetic, comparisons, and certain function-call conversions.
- How deep it goes
- Defines the initial promotion step and connects it to common arithmetic conversions, but does not enumerate every conversion rule.
- Examples
- Uses char, _Bool, and short arithmetic, plus -1 + 1U and cosf(1) passed to printf.
- What you can do after
- Evaluate arithmetic expressions by identifying narrow operands and the subsequent signed, unsigned, or floating conversion steps.
Read how Modern C, Third Edition explains integer promotion →
Modern C
Integer promotion is the C conversion of a narrow integer type to int or another integer type before certain operations such as arithmetic.
- How it is used
- Explains the conversion applied before arithmetic and comparison involving narrow integer types.
- How deep it goes
- Defines the promotion rule and its typical signed-int result, but defers detailed platform-dependent widths and ranges.
- Examples
- Uses char and bool as prominent narrow types and classifies base types in a tabular overview.
- What you can do after
- Evaluate arithmetic and comparison expressions involving narrow integer types with the promotion rule in mind.
What to know first
- timestampA timestamp is a value representing a specific point in time, often associated with an event, observation, or data item.
Related concepts
- narrow typeproduced by · A narrow type is a C integer or character type whose values undergo integer promotion before arithmetic evaluation.
- integerproduces · An integer is a whole-number value with no fractional part, including negative numbers, zero, and positive numbers.
- data conversionkind of · Data conversion is the transformation of a value or data from one type, format, or representation to another, explicitly or implicitly.
- number conversionkind of · The language process that converts a value to a numeric value according to coercion rules.
- promotioncontrasts with · Promotion is Julia's mechanism for converting values of different types to a common type suitable for a joint operation.
Questions about integer promotion
What is integer promotion?
Integer promotion is the implicit conversion of certain narrow integer operands to int or another suitable integer type before specified operations.
Which Manning books explain integer promotion?
Modern C, Third Edition and Modern C.
What should I know before learning integer promotion?
Manning books that teach integer promotion usually introduce derived type and timestamp first.
What is the difference between integer promotion and default argument conversion?
Integer promotion is the implicit conversion of certain narrow integer operands to int or another suitable integer type before specified operations. Default argument conversion is the C conversion of certain argument values to wider types when they are passed in contexts governed by default argument rules.
What is integer promotion a kind of?
Integer promotion is a kind of data conversion. Data conversion is the transformation of a value or data from one type, format, or representation to another, explicitly or implicitly.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

