An operator is a symbol or string of C characters used as a
function. One very valuable operator in C is the cast operator,
which converts one type into another. Its general form is as follows:
(type) variable
For example, floating point and integer types can be interconverted:
In the example above, the cast operator rounds the number down when
converting it from a float to an integer, because an integer number
cannot represent the fractional part after the decimal point. Note that
C always truncates, or rounds down, a number when converting it to
an integer. For example, both 3.1 and 3.9 are truncated to 3 when C is
converting them to integer values.
The cast operator works the other way around, too:
In converting large integers to floating point numbers, you
may lose some precision, since the float type guarantees only 6
significant digits, and the double type guarantees only 10.
It does not always make sense to convert types. (See Data structures, for examples of types that do not convert to other types
well.)