Keil Logo Arm Logo

CARM User's Guide

Discontinued

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
}

Keil logo

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.