Type Cast Operator: (type)
cast-expression :
unary-expression
( type-name ) cast-expression
A type cast provides a method for explicit conversion of the type of an object in a specific situation.
The compiler treats cast-expression as type type-name after a type cast has been made. Casts can be used to convert objects of any scalar type to or from any other scalar type. Explicit type casts are constrained by the same rules that determine the effects of implicit conversions. Additional restraints on casts may result from the actual sizes or representation of specific types.
Example
In the following example, the type cast operator converts the float value of 3.1 to an integer value of 3.
// Example of the type cast operator
float x = 3.1;
int i;
i = (int)x; // the value of i is now 3