Converting double to integer using fint() is not working. Is there any alternative for this?

Issue

This Content is from Stack Overflow. Question asked by Nitish Yadav

I want to convert 1.8 to 2.0 and then change the type of the result to an integer value i.e., 2. To do this, I execute the following function for the shown template.

int xx;
double dx=round(1.8);
void cast() { xx = fint(dx); }

enter image description here

Upon execution, the value of xx is still 0. Could someone please help me figure this out.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?