div, ldiv
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
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 for 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 terminates 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 structures are defined in
STDLIB.H.
-♦-