The word cast is used in the sense of “casting into a mold.” The
compiler will automatically change one type of data into another if
it makes sense. For instance, if you assign an integral value to a
floating-point variable, the compiler will secretly call a function (or
more probably, insert code) to convert the int to a float. Casting
allows you to make this type conversion explicit, or to force it when
it wouldn’t normally happen.
To perform a cast, put the desired data type (including all
modifiers) inside parentheses to the left of the value. This value canbe a variable, a constant, the value produced by an expression, or
the return value of a function. Here’s an example:
from:<Thinking in C++>