Include:
Prototype: div_t div(int numer, int denom);
ldiv_t ldiv(long int numer, long int denom);
Returns: (div) a div_t type structure
(ldiv) a ldiv_t type structure
The div and ldiv functions divide numer by denom, computing the quotient
and the remainder. The arguments for the div function are integers and the
arguments to the ldiv function are long integers. The sign of the quotient
is the same as that of the mathematical quotient. Its absolute value is
the largest integer that is less than the absolute value of the
mathematical quotient. If the denominator is 0 the program will terminate
with an error message.
Return Value
The div function returns a structure of type div_t, comprising both the
quotient and the remainder. The ldiv function returns a structure of type
ldiv_t. These structure is defined in STDLIB.H.