Skip to main content

Widening

Definition:
Another term for type promotion, converting to a larger type without loss of data.


Detailed Explanation

  • Widening is an implicit cast from a smaller to a larger type.
  • Safe because the larger type can represent all values of the smaller type.
  • Common when mixing integer and floating-point numbers.

Example

// int widened to long // int num = 100; // long bigNum = num;


⬅ Back