Syntax
int ArraySet( ITEM *array, size_t index, const ITEM *value );
Arguments
array is the array to access.
index is the one-based element position.
value is the ITEM to copy. Pass NULL to store NIL.
Return value
1 if the element was replaced, or 0 if the array or index is invalid.
Description
The array owns the replacement copy. A string gets its own storage; an array is not copied: the element holds the same array. AClone() duplicates an array.
Example
#include "xdev-wtui.h"
#include <stdio.h>
int main( void )
{
ITEM *array = Array( 2 );
ITEM *source = ItemPutC( NULL, "Ready" );
if( !ArraySet( array, 1, source ) )
{
ItemRelease( source );
ItemRelease( array );
return 1;
}
ItemRelease( source );
puts( ArrayGetCPtr( array, 1 ) );
ItemRelease( array );
return 0;
}
Output
Ready