ptrdiff_t(3type)

ptrdiff_t3type

Count of elements or array index

Usage

#include <stddef.h>

typedef /* ... */ ptrdiff_t;

Library

Standard C library (libc)

Overview

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) and the scanf(3) families of functions is t, resulting commonly in %td or %ti for printing ptrdiff_t values.

Releases

3 releases since Debian 12 (Bookworm); the text changed 2 times.

  1. 12
  2. 13
  3. Arch

Standards

C11, POSIX.1-2024.

History

C89, SUSv1, POSIX.1-2001.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.