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

# countof(3)

count the number of elements in an array

## NAME

countof, \_Countof - count the number of elements in an array

## LIBRARY

Standard C library (*libc*)

## SYNOPSIS

```
#include <stdcountof.h>
```

**size\_t countof(***array***);**

## DESCRIPTION

This operator counts the number of elements in an array.

If the operand is not an array, it produces a compilation error.

There's a keyword, **\_Countof**(), that behaves identically, and can be used without including *\<stdcountof.h\>*.

## RETURN VALUE

The number of elements in the array.

## STANDARDS

C2y.

## HISTORY

gcc 16, clang 21, gnulib 202507.

## SEE ALSO

[**operator**(7)](/operator/7.md)
