Yes, though you'll probably get a warning telling you that it's not safe. You can silence the warning with a cast.
Code:
int i = static_cast<int>(123.456);
The net result is that everything past the radix will be truncated, and i will have the value 123. But, and there's usually a "but", if you have to use a cast, you're probably doing something you shouldn't be.
For example, if what you want is to remove any precision from a double value, you can do it with a library function, still use doubles, and avoid any casting.
Code:
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
double a = 123.456, b;
cout<< modf(a, &b) <<endl;
cout<< a <<'\n'<< b <<endl;
}
On top of that, modf also returns a normalized double for everything past the radix (0.456). Doing that with the casting method just feels icky.
Code:
#include <iostream>
using namespace std;
int main()
{
double a = 123.456, b;
int c;
c = static_cast<int>(a);
b = a - c;
cout<< b <<endl;
cout<< a <<'\n'<< c <<endl;
}