ldiv Function (Macro)

stdlib.h

ldiv_t ldiv (long n, long d);

Divides two long integers, and returns quotient and remainder.

ldiv divides two long integers and returns both the quotient and the remainder as a ldiv_t type. numer and denom are the numerator and the denominator, respectively. div returns a structure whose elements are quot (the quotient) and rem (the remainder).

Note: ldiv is an inline function, implemented using GNU C smart macros.