Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>div</b> http://www.ousob.com [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
div
===

Syntax
------

     #include <stdlib.h>
     
     div_t div(int numberator, int denomonator);

Description
-----------

Returns the quotient and remainder of the division NUMBERATOR divided
by DENOMONATOR.  The return type is as follows:

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

Return Value
------------

The results of the division are returned.

Example
-------

     div_t d = div(42, 3);
     printf("42 = %d x 3 + %d\n", d.quot, d.rem);
     
     div(+40, +3) = { +13, +1 }
     div(+40, -3) = { -13, -1 }
     div(-40, +3) = { -13, -1 }
     div(-40, -3) = { +13, -1 }


Online resources provided by: http://www.ousob.com --- NG 2 HTML conversion by Dave Pearson