Erm, (float)10/2 is not 2.5 coliru.stacked-crooked.com/a/77b57...
(float)10/2
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
(float)10
float(10)
(float) "danger"s
Yes...! You are correct. But that is what my point is. You shouldn't use C-style cast.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Erm,
(float)10/2
is not 2.5 coliru.stacked-crooked.com/a/77b57...Also, "you can also write
(float)10
likefloat(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 doneYes...! You are correct. But that is what my point is.
You shouldn't use C-style cast.