I have seen people asking how do I convert a float to integer. I have even seen people convert values to strings and back again.
This is an easy way to convert a float to integer. It is a simple matter of casting, like so…
float flt = 2.0f;
int = 0i;
i = (int) flt; // <— that is it!
The variable i is now = 2 and an integer.