What is Integer promotion?
The C rule that converts values of integer types smaller than int (char, short, bit-fields and so on) to int (or to unsigned int if int cannot represent them) before an operation. As a result, even the sum of two 8-bit uint8_t values is computed at the width of int, and the result of applying ~ has 1s in the upper bits as well. The value returns to the narrower width when the result is assigned to a variable of a smaller type. Together with the "usual arithmetic conversions", which unify types in operations mixing signed and unsigned operands, it affects the results of comparisons and bitwise operations.
Japanese name: 整数拡張
Integer promotion appears in 2 practice questions across 1 topic, including C Programming Basics.
Field: C Programming Basics