www.LinuxHowtos.org
countof
Section: C Library Functions (3)Updated: 202-0-10
Index Return to Main Contents
NAME
countof, _Countof - count the number of elements in an arrayLIBRARY
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)