Item

ArrayGetND

Return an array element as a double

Syntax

Signature
double ArrayGetND( const ITEM *array, size_t index );

Arguments

array Array to access.

index Element position, counted from 1.

Return value

The stored double, an integer converted to double, or 0.0 for a missing element or a different type.

Description

Reads a numeric slot as double. Converting large integers to double can lose precision. Use ArrayGetNInt() if you need the original integer.

Example

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

#include <stdio.h>

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

   if( !array )
      return 1;

   ArraySetND( array, 1, 12.5 );
   printf( "%.1f\n", ArrayGetND( array, 1 ) );
   ItemRelease( array );

   return 0;
}