| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <inttypes.h> imaxdiv_t imaxdiv (intmax_t numerator, intmax_t denominator); |
Returns the quotient and remainder of the division numerator divided by denominator. The return type is as follows:
typedef struct {
intmax_t quot;
intmax_t rem;
} imaxdiv_t;
|
The results of the division are returned.
| ANSI/ISO C | C99; not C89 |
| POSIX | 1003.1-2001; not 1003.2-1992 |
imaxdiv_t l = imaxdiv(42, 3);
printf("42 = %" PRIdMAX " x 3 + %" PRIdMAX "\n", l.quot, l.rem);
imaxdiv(+40, +3) = { +13, +1 }
imaxdiv(+40, -3) = { -13, -1 }
imaxdiv(-40, +3) = { -13, -1 }
imaxdiv(-40, -3) = { +13, -1 }
|