SW StudyWalks

Computer Science  /  CS 0365  ·  Atom · ~20 seconds

Coercion and the Type Cast

Video not yet published
to the StudyWalks catalog
State

Coercion is relaxed type checking — a smaller type's value fits legally into a larger one — while the reverse requires a type cast, forcing a larger value into a smaller space.

Show

A two-byte count assigned into four bytes passes untouched; the reverse trip needs paperwork.

Watch for

The paperwork exists because the reverse trip has consequences.