Type Conversion
Objectives:
- In Mixed-mode expressions
- When passing parameters to functions
- When returning values from functions
Mechanisms:
- Casting
- Explicit Conversion: Initiated in code by the Programmer
- Coercion
- Implicit Conversion: Automatically initiated by the Compiler
- Case Studies
Types of Conversion:
- Narrowing: From a larger data type to a smaller data type
- Widening: From a smaller data type to a larger data type