totn C Functions

C Language: ldiv function
(Long Integer Division)

In the C Programming Language, the ldiv function divides numerator by denominator. Based on that division calculation, the ldiv function returns a structure containing two members - quotient and remainder.

Syntax

The syntax for the ldiv function in the C Language is:

ldiv_t ldiv(long int numerator, long int denominator);

Parameters or Arguments

numerator
A value divided by denominator in the division calculation.
denomindator
A 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 ldiv 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 ldiv function is:

#include <stdlib.h>

Applies To

In the C Language, the ldiv function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the ldiv function: