Possible Duplicate:
C++: What's the difference between function(myVar) and (function)myVar ?
I have seen and used both variants of these typecasts:
int(floatvar)
(int)floatvar
Is there any difference between the two? Are there any preferences about when to use which?
There is no difference between them.
(int)floatvaris C way of doing the cast where asint(floatvar)is the C++ way (Although it is better to be explicit and usestatic_cast<>).