How can we extract the decimal part of a floating point number and store the decimal part and the integer part into two separate integer variables?
You use the modf
function:
double integral;
double fractional = modf(some_double, &integral);
You can also cast it to an integer, but be warned you may overflow the integer. The result is not predictable then.