Item

ArraySize

Grow or shrink an array

Syntax

Signature
int ArraySize( ITEM *array, size_t length );

Arguments

array Array to resize.

length Requested number of elements. Zero empties the array.

Return value

1; 0 when array is NULL or not an array.

Description

As ASize(): new elements are NIL, the elements cut off are released. The length may be 0.

Example

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

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

int main( void )
{
   ITEM *array = Array( 2 );

   if( !array )
      return 1;

   ArraySetC( array, 1, "First" );
   ArraySetC( array, 2, "Second" );

   if( ArraySize( array, 3 ) )
      printf( "Length: %" PRId64 "\n", ArrayLen( array ) );
   ItemRelease( array );

   return 0;
}

See also