The modf() family of functions all take a pointer parameter:
float modff( float arg, float* iptr );
double modf( double arg, double* iptr );
long double modfl( long double arg, long double* iptr );
for returning the integral part of their input arg (the fractional part is the actual return value).
If I only need the fractional part, can I "skip" the computation of the integral part by passing NULL?
Neither the cppreference page I liked to, nor man modff, say anything about what happens when you pass NULL for iptr, while some other standard library functions take NULL as an indication of "ignore this parameter".
modf(double arg, double* iptr)and friends lack defined functionality wheniptr == NULL. Passing aNULLis undefined behavior (UB).If code wants a one liner that does not need to save the integer part for later use, consider a compound literal for the temporary
doubleand trust the compiler to optimize as able.