Facebook Page Twitter Page LinkedIn Page
× C Standard Library


The C <stdlib.h> lldiv_t is a structure to represent both the quotient and the remainder of the division of the integral numerator by integral denominator. This is the type returned by lldiv() function.

In the <stdlib.h> header file, it is defined as follows:

struct lldiv_t { long long quot; long long rem; };

or 

struct lldiv_t { long long rem; long long quot; };

Example:

The below example shows the usage of <stdlib.h> lldiv_t type.

#include <stdio.h>
#include <stdlib.h>
 
int main (){
  lldiv_t result = lldiv(50, 17);

  printf("lldiv(50, 17) gives quotient = %lld and remainder = %lld",
      result.quot, result.rem);
  
  return 0;
}

The output of the above code will be:

lldiv(50, 17) gives quotient = 2 and remainder = 16

❮ C <stdlib.h> Library