I'm using C (not C++).
I need to convert a float number into an int. I do not want to round to the the nearest number, I simply want to eliminate what is after the integer part. Something like
4.9 -> 4.9-> 4
I'm using C (not C++).
I need to convert a float number into an int. I do not want to round to the the nearest number, I simply want to eliminate what is after the integer part. Something like
4.9 -> 4.9-> 4
my_var = (int)my_var; As simple as that. Basically you don't need it if the variable is int.
Use in C
int C = var_in_float; They will convert implicit
Thank you