---
name: "array_length"
section: "3diet"
platform: "linux"
package: "libowfat-dev"
version: "0.28-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/array_length/3diet"
---

# array\_length(3diet)

get number of allocated members in array

## NAME

array\_length - get number of allocated members in array

## SYNTAX

**#include \<array.h\>**

int64 **array\_length**(array\* *x*,uint64 *membersize*);

  array *x*;\
   int64 members = array\_length(&*x*,sizeof(*t*));

## DESCRIPTION

array\_length returns the number of initialized bytes in *x*, divided by the size of *t*. In other words, array\_get will succeed for positions 0 through array\_length-1; it will fail for position array\_length.

If *x* is unallocated, array\_length and array\_bytes return 0.

## SEE ALSO

[array\_allocate(3)](/array_allocate/3.md), [array\_get(3)](/array_get/3.md), [array\_fail(3)](/array_fail/3.md), [array\_bytes(3)](/array_bytes/3.md)
