Promotion is never a problem because the lower data type (smaller range of allowable values) is sub set of the higher data type (larger range of allowable values). Promotion often occurs with three of the standard data types: character, integer and floating-point. The allowable values (or domains) progress from one type to another. That is the character data type values are a sub set of integer values and integer values are a sub set of floating-point values; and within the floating-point values: float values are a sub set of double. Even though character data represent the alphabetic letters, numeral digits (0 to 9) and other symbols (a period, $, comma, etc.) their bit pattern also represent integer values from 0 to 255. This progression allows us to promote them up the chain from character to integer to float to double.
You are here
Home » Programming Fundamentals -A Modular Structured Approach using C++ » Data & Operators » Data Type Conversions
- Front Matter
- Body Matter
- Back Matter