Syntax
ITEM *ArrayGetItemPtr( const ITEM *array, size_t index );
Arguments
array Array containing the element.
index One-based position of the element.
Return value
A borrowed pointer to the element, or NULL if the array or index is invalid.
Description
Use the returned pointer with ItemGet*() / ItemPut*() or as a row in a nested array. The array owns the element. Reacquire the pointer after operations that modify the array structure.
Example
#include "xdev-wtui.h"
#include <stdio.h>
int main( void )
{
ITEM *dimensions = Array( 2 );
if( !dimensions )
return 1;
ITEM *depth = ArrayGetItemPtr( dimensions, 2 );
ItemPutNI( depth, 18 );
printf( "Depth: %d\n", ArrayGetNI( dimensions, 2 ) );
ItemRelease( dimensions );
return 0;
}
Output
Depth: 18