

div_t ldiv( int n, int d )
int n; /* numerator */ int d; /* divisor */



Synopsis 
#include "stdlib.h"
The div function computes the quotient and remainder of the division of n by d .


Parameters 
n may be any integer; d may not be 0.


Return Value 
ldiv returns a struct of type ldiv_t , containing the quotient and remainder, as defined in stdlib.h . If the result cannot be represented, the behavior of ldiv is undefined.


Comments 
if d is 0, then the program will halt.


See Also 



