Item

ArrayGetNInt

Return an array element as a 64-bit integer

Syntax

Signature
int64_t ArrayGetNInt( const ITEM *array, size_t index );

Arguments

array Array to access.

index Element position, counted from 1.

Return value

The stored integer, a finite double truncated toward zero if its value fits in int64_t after truncation, or 0 for a missing element, a different type or a non-finite double.

Description

Reads a numeric slot as a signed 64-bit integer. Use ArrayGetND() for values that should retain a fractional part.

Example

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

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

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

   if( !array )
      return 1;

   ArraySetNInt( array, 1, INT64_C( 5000000000 ) );
   printf( "%" PRId64 "\n", ArrayGetNInt( array, 1 ) );
   ItemRelease( array );

   return 0;
}