0

Casting

int main() { int a=1.5; cout<<static_cast<float>(a); return 0; } I think the output is 1.5, but not. Why,plz?!

5th Jul 2020, 6:08 AM
Huda Le
Huda Le - avatar
1 Answer
+ 1
Hi! You declare a = 1.5 as an integer but it is already float? Integers are 0, 1, 3, 4, 5, ......
5th Jul 2020, 7:04 AM
yyy