C Language: div function
(Integer Division)
In the C Programming Language, the div function divides numerator by denominator. Based on that division calculation, the div function returns a structure containing two members - quotient and remainder.
Syntax
The syntax for the div function in the C Language is:
div_t div(int numerator, int denominator);
Parameters or Arguments
- numerator
- The value that is divided by denominator in the division calculation.
- denominator
- The value divided into numerator in the division calculation. So if numerator is 10 and denominator is 2, then 10 would be divided by 2.
Returns
The div function returns a structure with the resulting quotient and remainder based on the division calculation.
Required Header
In the C Language, the required header for the div function is:
#include <stdlib.h>
Applies To
In the C Language, the div function can be used in the following versions:
- ANSI/ISO 9899-1990
Similar Functions
Other C functions that are similar to the div function:
Advertisements