div Function (Macro)

stdlib.h

div_t div (short numer, short denom);

Divides two short integers, and returns quotient and remainder.

div divides two integers and returns both the quotient and the remainder as a div_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: div is an inline function, implemented using GNU C smart macros.