| 1 |
.\" Copyright 2020, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH div_t 3type 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
div_t, ldiv_t, lldiv_t, imaxdiv_t \- |
| 9 |
quotient and remainder of an integer division |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.EX |
| 15 |
.B #include <stdlib.h> |
| 16 |
.P |
| 17 |
.B typedef struct { |
| 18 |
.BR " int quot;" " /* Quotient */" |
| 19 |
.BR " int rem;" " /* Remainder */" |
| 20 |
.B } div_t; |
| 21 |
.P |
| 22 |
.B typedef struct { |
| 23 |
.BR " long quot;" " /* Quotient */" |
| 24 |
.BR " long rem;" " /* Remainder */" |
| 25 |
.B } ldiv_t; |
| 26 |
.P |
| 27 |
.B typedef struct { |
| 28 |
.BR " long long quot;" " /* Quotient */" |
| 29 |
.BR " long long rem;" " /* Remainder */" |
| 30 |
.B } lldiv_t; |
| 31 |
.P |
| 32 |
.B #include <inttypes.h> |
| 33 |
.P |
| 34 |
.B typedef struct { |
| 35 |
.BR " intmax_t quot;" " /* Quotient */" |
| 36 |
.BR " intmax_t rem;" " /* Remainder */" |
| 37 |
.B } imaxdiv_t; |
| 38 |
.EE |
| 39 |
.SH DESCRIPTION |
| 40 |
.RI [[ l ] l ] div_t |
| 41 |
is the type of the value returned by the |
| 42 |
.RB [[ l ] l ]\c |
| 43 |
.BR div (3) |
| 44 |
function. |
| 45 |
.P |
| 46 |
.I imaxdiv_t |
| 47 |
is the type of the value returned by the |
| 48 |
.BR imaxdiv (3) |
| 49 |
function. |
| 50 |
.SH STANDARDS |
| 51 |
C11, POSIX.1-2024. |
| 52 |
.SH HISTORY |
| 53 |
.TP |
| 54 |
.I div_t |
| 55 |
.TQ |
| 56 |
.I ldiv_t |
| 57 |
SUSv1, |
| 58 |
C99, |
| 59 |
POSIX.1-2001. |
| 60 |
.TP |
| 61 |
.I lldiv_t |
| 62 |
.TQ |
| 63 |
.I imaxdiv_t |
| 64 |
C99, POSIX.1-2001. |
| 65 |
.SH SEE ALSO |
| 66 |
.BR div (3), |
| 67 |
.BR imaxdiv (3), |
| 68 |
.BR ldiv (3), |
| 69 |
.BR lldiv (3) |