Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>ldiv</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ldiv

Usage

   #include <stdlib.h>

   ldiv_t ldiv(long int numerator, long int denominator)

   ANSI

Description

   The ldiv function divides the numerator by the denominator, returning the
   quotient and remainder. If the denominator is 0 the program will
   terminate with an error message. The arguments and the returned values
   are all type long.

Example 

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

   int main()
   {
       long numer,denom;
       ldiv_t result;
       numer = 3;

       denom = 2;
       printf("The numerator is %ld ", numer);
       printf("and the denominator is %ld\n", denom);
       result = ldiv(numer,denom);
       printf("The quotient is %ld \n",result.quot);
       printf("The remainder is %ld \n",result.rem);
       return EXIT_SUCCESS;
   }

Return Value

   ldiv returns a structure of type ldiv_t, containing both quotient and
   remainder.

See Also

   div



See Also: div

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson