Item

ArraySetNI

Store an int in an array element

Syntax

Signature
int ArraySetNI( ITEM *array, size_t index, int value );

Arguments

array is the array to access.

index is the one-based element position.

value is the signed integer to store.

Return value

1 if the element was replaced, or 0 if the array or index is invalid.

Description

Replaces the selected element with an IT_INTEGER value and keeps the array length.

Example

arraysetni.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