Keil Logo

div_t

The div_t type is defined in stdlib.h. It specifies the return type of the div library routine. It is defined as:

typedef struct _div_t {
        int rem;
        int quot;
} div_t;

and is used as shown in the following example:

#include <stdlib.h>

void func (void) {
  div_t res;

  res = div(345, 234);               // Do division
  if (res.rem >= 234/2) res.quot++;  // Round off
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.