libc.info: ldiv

Go forward to malloc
Go backward to labs
Go up to Stdlib
Go to the top op libc

`ldiv'--divide two long integers

*Synopsis*
     #include <stdlib.h>
     ldiv_t ldiv(long N, long D);
   *Description*
Divide N/D, returning quotient and remainder as two long integers in a
structure `ldiv_t'.
*Returns*
The result is represented with the structure
      typedef struct
      {
       long quot;
       long rem;
      } ldiv_t;
   where the `quot' field represents the quotient, and `rem' the
remainder.  For nonzero D, if ``R = ldiv(N,D);'' then N equals ``R.rem
+ D*R.quot''.
   To divide `int' rather than `long' values, use the similar function
`div'.
*Portability*
`ldiv' is ANSI.
   No supporting OS subroutines are required.