Item

ArrayGetNI

Read an array element as an int

Syntax

Signature
int ArrayGetNI( const ITEM *array, size_t index );

Arguments

array is the array to access.

index is the one-based element position.

Return value

The numeric value converted to int, or 0 for an invalid index or an element of another type.

Description

Uses the same conversion as ItemGetNI(). Use ArrayGetNInt() for a signed 64-bit integer.

Example

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

#include <stdio.h>

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

   ArraySetNI( array, 1, 42 );
   printf( "%d\n", ArrayGetNI( array, 1 ) );
   ItemRelease( array );

   return 0;
}

Output

42

See also