Name

ldiv

Synopsis

Performs integer division, returning quotient and remainder

#include <stdlib.h>
ldiv_tldiv( long dividend, long divisor );

The parameters of ldiv() are long integers, and its return value is a structure of type ldiv_t containing two long integers. Otherwise, ldiv() works the same as the int function div().

Example

See the example for div() in this chapter.

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.