---
name: "size_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/size_t/3type"
---

# size\_t(3type)

count of bytes

## NAME

size\_t, ssize\_t - count of bytes

## LIBRARY

Standard C library (*libc*)

## SYNOPSIS

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

**typedef** /\* ... \*/  **size\_t;**

**#include \<sys/types.h\>**

**typedef** /\* ... \*/  **ssize\_t;**

## DESCRIPTION

- *size\_t*

  Used for a count of bytes. It is the result of the *sizeof*() operator. It is an unsigned integer type capable of storing values in the range \[**0**, **SIZE\_MAX**\].

- *ssize\_t*

  Used for a count of bytes or an error indication. It is a signed integer type capable of storing values at least in the range \[**-1**, **SSIZE\_MAX**\].

### Use with printf(3) and scanf(3)

- *size\_t*

  The length modifier for *size\_t* for the [**printf**(3)](/printf/3.md) and the [**scanf**(3)](/scanf/3.md) families of functions is **z**, resulting commonly in **%zu** or **%zx** for printing *size\_t* values.

- *ssize\_t*

  glibc and most other implementations provide a length modifier for *ssize\_t* for the [**printf**(3)](/printf/3.md) and the [**scanf**(3)](/scanf/3.md) families of functions, which is **z**; resulting commonly in **%zd** or **%zi** for printing *ssize\_t* values. Although **z** works for *ssize\_t* on most implementations, portable POSIX programs should avoid using it—for example, by converting the value to *intmax\_t* and using its length modifier (**j**).

## STANDARDS

- *size\_t*

  C11, POSIX.1-2024.

- *ssize\_t*

  POSIX.1-2024.

## HISTORY

- *size\_t*

  C89, POSIX.1-1990.

- *ssize\_t*

  POSIX.1-1990.

*\<aio.h\>*, *\<glob.h\>*, *\<grp.h\>*, *\<iconv.h\>*, *\<mqueue.h\>*, *\<pwd.h\>*, *\<signal.h\>*, and *\<sys/socket.h\>* define *size\_t* since POSIX.1-2008.

*\<aio.h\>*, *\<mqueue.h\>*, and *\<sys/socket.h\>* define *ssize\_t* since POSIX.1-2008.

## NOTES

- *size\_t*

  The following headers also provide *size\_t*: *\<aio.h\>*, *\<glob.h\>*, *\<grp.h\>*, *\<iconv.h\>*, *\<monetary.h\>*, *\<mqueue.h\>*, *\<ndbm.h\>*, *\<pwd.h\>*, *\<regex.h\>*, *\<search.h\>*, *\<signal.h\>*, *\<stdio.h\>*, *\<stdlib.h\>*, *\<string.h\>*, *\<strings.h\>*, *\<sys/mman.h\>*, *\<sys/msg.h\>*, *\<sys/sem.h\>*, *\<sys/shm.h\>*, *\<sys/socket.h\>*, *\<sys/types.h\>*, *\<sys/uio.h\>*, *\<time.h\>*, *\<unistd.h\>*, *\<wchar.h\>*, and *\<wordexp.h\>*.

- *ssize\_t*

  The following headers also provide *ssize\_t*: *\<aio.h\>*, *\<monetary.h\>*, *\<mqueue.h\>*, *\<stdio.h\>*, *\<sys/msg.h\>*, *\<sys/socket.h\>*, *\<sys/uio.h\>*, and *\<unistd.h\>*.

## SEE ALSO

[**read**(2)](/read/2.md), [**readlink**(2)](/readlink/2.md), [**readv**(2)](/readv/2.md), [**recv**(2)](/recv/2.md), [**send**(2)](/send/2.md), [**write**(2)](/write/2.md), [**fread**(3)](/fread/3.md), [**fwrite**(3)](/fwrite/3.md), [**memcmp**(3)](/memcmp/3.md), [**memcpy**(3)](/memcpy/3.md), [**memset**(3)](/memset/3.md), [**offsetof**(3)](/offsetof/3.md), [**ptrdiff\_t**(3type)](/ptrdiff_t/3type.md)
