div3
Return quotient and remainder from division
Usage
Standard C Library (libc, -lc)
#include <stdlib.h>
div_t
div(int numer, int denom);
ldiv_t
ldiv(long numer, long denom);
lldiv_t
lldiv(long long numer, long long denom);
#include <inttypes.h>
imaxdiv_t
imaxdiv(intmax_t numer, intmax_t denom);
Overview
The div(), ldiv(), lldiv(), and imaxdiv() functions compute the value of numer (the numerator) divided by denom (the denominator) and return the stored result in the form of the div_t, ldiv_t, lldiv_t, or imaxdiv_t types, respectively. These types are structs which contain two int, long, long long, or intmax_t members named quot (the quotient) and rem (the remainder).
Releases
87 releases since FreeBSD 2.0.5-RELEASE; the text changed 42 times.