countof, _Countof − count the number of elements in an array
Standard C library (libc)
#include <stdcountof.h>
size_t countof(array);
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>.
The number of elements in the array.
C2y.
gcc 16, clang 21.
operator(7)