modf : modf « math.h « C Tutorial






ItemValue
Header filemath.h
Declaratinfloat modff(float num, float *i);
double modf(double num, double *i);
long double modfl(long double num, long double *i);
Functiondecomposes num into its integer and fractional parts.
Returnreturns the fractional portion and place the integer part in the variable pointed to by i.


#include <math.h>
  #include <stdio.h>

  int main(void)
  {
     double i;
     double f;

     f = modf(10.123, &i);
     printf("%f %f",i , f);
  }
10.000000 0.123000








19.51.modf
19.51.1.modf