Item

ArrayLen

Return the number of elements in an array

Syntax

Signature
int64_t ArrayLen( const ITEM *array );

Arguments

array Array to measure.

Return value

The length of the array, or 0 for an empty array or an argument of another type.

Description

NIL slots count toward the length. For a multidimensional array, the result is the length of the outer array. Use ArrayLen() on a row to get its length.

Example

arraylen.c
#include "xdev-wtui.h"

#include <inttypes.h>
#include <stdio.h>

int main( void )
{
   ITEM *tasks = Array( 3 );

   if( !tasks )
      return 1;

   printf( "%" PRId64 " slots\n", ArrayLen( tasks ) );
   ItemRelease( tasks );

   return 0;
}

Output

3 slots

See also