-2

Hi I would like to know what is the difference between these two forms of type casting:

float flt=2.33;
int x;
x=static_cast<int> flt;

and

  x=(int)flt;
fatCop
  • 2,556
  • 10
  • 35
  • 57
hacker804
  • 101
  • 3

1 Answers1

0

The static_cast is a C++ style cast whereas the () cast inherits from C. Try to use static_cast over the C cast as it is more reliable in terms of providing compile time errors in your cast instead of just letting the compiler ignore fatal bugs.