| 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 ptrdiff_t 3type 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
ptrdiff_t \- count of elements or array index |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.B #include <stddef.h> |
| 15 |
.P |
| 16 |
.BR typedef " /* ... */ " ptrdiff_t; |
| 17 |
.fi |
| 18 |
.SH DESCRIPTION |
| 19 |
Used for a count of elements, or an array index. |
| 20 |
It is the result of subtracting two pointers. |
| 21 |
It is a signed integer type |
| 22 |
capable of storing values in the range |
| 23 |
.RB [ PTRDIFF_MIN , |
| 24 |
.BR PTRDIFF_MAX ]. |
| 25 |
.P |
| 26 |
The length modifier for |
| 27 |
.I ptrdiff_t |
| 28 |
for the |
| 29 |
.BR printf (3) |
| 30 |
and the |
| 31 |
.BR scanf (3) |
| 32 |
families of functions is |
| 33 |
.BR t , |
| 34 |
resulting commonly in |
| 35 |
.B %td |
| 36 |
or |
| 37 |
.B %ti |
| 38 |
for printing |
| 39 |
.I ptrdiff_t |
| 40 |
values. |
| 41 |
.SH STANDARDS |
| 42 |
C11, POSIX.1-2024. |
| 43 |
.SH HISTORY |
| 44 |
C89, |
| 45 |
SUSv1, |
| 46 |
POSIX.1-2001. |
| 47 |
.SH SEE ALSO |
| 48 |
.BR size_t (3type) |