ldiv_t ldiv(long int numer,
            long int denom);

ldiv computes numer / denom and numer % denom in a single operation.

ldiv returns a structure of type ldiv_t comprising both the quotient and the remainder. The structures contain the members quot (the quotient) and rem (the remainder), each of which has the same type as the arguments numer and denom. If either part of the result cannot be represented, the behavior is undefined.

See Also