DEV Community

Discussion on: C++ type casting with example for C developers

Collapse
 
sehe profile image
sehe

Erm, (float)10/2 is not 2.5 coliru.stacked-crooked.com/a/77b57...

Also, "you can also write (float)10 like float(10) isn't correct and makes it seem as if they're interchangable. I know some later text mentions the danger (eg (float) "danger"s) but by then the damage might be done

Collapse
 
visheshpatel profile image
Vishal Chovatiya

Yes...! You are correct. But that is what my point is.
You shouldn't use C-style cast.