my_var = (int)my_var;
As simple as that.
Basically you don’t need it if the variable is int.
Related Contents:
- C# Float expression: strange behavior when casting the result float to int
- Checking if float is an integer
- Double cast to unsigned int on Win32 is truncating to 2,147,483,648
- What is the difference between casting to `float` and adding `f` as a suffix when initializing a `float`?
- How to convert string to float?
- C job interview – casting and comparing
- Nonintuitive result of the assignment of a double precision number to an int variable in C
- Do I cast the result of malloc?
- Easiest way to convert int to string in C++
- How do I check if a string is a number (float)?
- What is size_t in C?
- Does it make sense to use “as” instead of a cast even if there is no null check? [closed]
- How do I restrict a float value to only two places after the decimal point in C?
- Is the size of C “int” 2 bytes or 4 bytes?
- How do I check if a string represents a number (float or int)?
- How to convert integer to string in C? [duplicate]
- convert double to int
- How to cast/convert pointer to reference in C++
- In C, why do some people cast the pointer before freeing it?
- Can I convert long to int?
- ‘float’ vs. ‘double’ precision
- Signed to unsigned conversion in C – is it always safe?
- Why doesn’t C have unsigned floats?
- Convert a character digit to the corresponding integer in C
- Converting String To Float in C#
- What’s the difference between hard and soft floating point numbers?
- How to convert char to integer in C? [duplicate]
- How to convert string to integer in C#
- How do I convert Int/Decimal to float in C#?
- Why cast free’s return value to void?
- What’s the use of suffix `f` on float value
- Make C floating point literals float (rather than double)
- Convert double to float by cast or Convert.ToSingle()?
- Type conversion – unsigned to signed int/char
- How to get the sign, mantissa and exponent of a floating point number
- Can I check if a variable can be cast to a specified type?
- What is the difference between casting and conversion? [duplicate]
- Cast class into another class or convert class to another
- Why does MSVS not optimize away +0? [duplicate]
- %i or %d to print integer in C using printf()?
- C++ floating point to integer type conversions
- What happens when I assign long int to int in C?
- Should I explicitly cast malloc()’s return value? [duplicate]
- How does this float square root approximation work?
- C char* to int conversion
- How does printf and co differentiate between float and double
- C: How to wrap a float to the interval [-pi, pi)
- What does (void *)1 mean?
- Efficient floating-point division with constant integer divisors
- Difference between unsigned and unsigned int in C