Language | Libraries | Comparison
The cast operator translates one variable type into another and forces calculations to be performed in the cast type.
(type)variable
type: any variable type (e.g. int, float, byte)
variable: any variable or constant
int i; float f; f = 3.6; i = (int) f; // now i is 3
When casting from a float to an int, the value is truncated not rounded. So both (int) 3.2
and (int) 3.7
are 3.
Corrections, suggestions, and new documentation should be posted to the Forum.