Narrowing
Definition:
A type of casting that converts from a larger data type to a smaller one, potentially losing data.
Detailed Explanation
- Requires explicit casting to confirm intent.
- Can cause overflow or precision loss.
- Often used for optimization or specific data formats.
Example
// double to int narrowing // double pi = 3.14; // int i = (int) pi; // i = 3