ldiv_t - C stdlib.h

C examples for stdlib.h:ldiv_t

Type

data type

From

<cstdlib>
<stdlib.h>

Description

Structure returned by ldiv

typedef struct {
  long int quot;
  long int rem;
} ldiv_t;

Members

MemberDescription
quot the quotient of the integral division operation performed by ldiv
rem the remainder of the integral division operation performed by ldiv

Demo Code


#include <stdio.h>
#include <stdlib.h>

int main ()/*from   ww  w  .  j  a v a 2 s . c om*/
{
  ldiv_t ldivresult;
  ldivresult = ldiv (1000000L,12L);
  printf ("1000000 div 12 => %ld, remainder %ld.\n", ldivresult.quot, ldivresult.rem);
  return 0;
}

Related Tutorials