C examples for stdlib.h:ldiv_t
data type
<cstdlib> <stdlib.h>
Structure returned by ldiv
typedef struct { long int quot; long int rem; } ldiv_t;
Member | Description |
---|---|
quot | the quotient of the integral division operation performed by ldiv |
rem | the remainder of the integral division operation performed by ldiv |
#include <stdio.h> #include <stdlib.h> int main ()/*from ww w . j a v a 2 s . c om*/ { ldiv_t ldivresult; ldivresult = ldiv (1000000L,12L); printf ("1000000 div 12 => %ld, remainder %ld.\n", ldivresult.quot, ldivresult.rem); return 0; }