Functions HI-TECH C DIV

From HI-TECH C for CP/M Fan WIKI(EN)
Jump to: navigation, search



#include  <stdlib.h>

div_t     div(int numer, int denom)
ldiv_t    ldiv(long numer, long denom)


The div() function computes the quotient and remainder of the divison of numer by denom. The div() function returns a structure of type div_t, containing both the quotient and remainder. ldiv() is similar to div() except it takes arguments of type long and returns a structure of type ldiv_t. The types div_t and ldiv_t are defined in <stdlib.h> as follows:

typedef struct {
   intquot, rem;
} div_t;

typedef struct {
   longquot, rem;
} ldiv_t;