---
name: "ptrdiff_t"
section: "3type"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ptrdiff_t/3type"
---

# ptrdiff\_t(3type)

count of elements or array index

## NAME

ptrdiff\_t - count of elements or array index

## LIBRARY

Standard C library (*libc*)

## SYNOPSIS

```
#include <stddef.h>
```

**typedef** /\* ... \*/  **ptrdiff\_t;**

## DESCRIPTION

Used for a count of elements, or an array index. It is the result of subtracting two pointers. It is a signed integer type capable of storing values in the range \[**PTRDIFF\_MIN**, **PTRDIFF\_MAX**\].

The length modifier for *ptrdiff\_t* for the [**printf**(3)](/printf/3.md) and the [**scanf**(3)](/scanf/3.md) families of functions is **t**, resulting commonly in **%td** or **%ti** for printing *ptrdiff\_t* values.

## STANDARDS

C11, POSIX.1-2024.

## HISTORY

C89, SUSv1, POSIX.1-2001.

## SEE ALSO

[**size\_t**(3type)](/size_t/3type.md)
