Click or drag to resize

ArrayInit Function

X#
Create an initialized array.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION ArrayInit(
	wElements AS DWORD,
	avalues REF USUAL[]
) AS ARRAY
Request Example View Source

Parameters

wElements
Type: DWord
The number of elements.
avalues
Type: Usual

Return Value

Type: Array
An initialized array with the specified number of elements and referenced values in each element.
Remarks
ArrayInit() builds an array with the specified number of elements and initializes the elements with the pointer contents.
At least wElements data of type USUAL must be at the location referenced by .
To create an uninitialized array, see ArrayNew().
Examples
This example creates and initializes a 2-element array.
An existing DIM array serves as the pointer to the initialized data:
X#
1FUNCTION Start()
2    LOCAL aOffsets AS ARRAY
3    LOCAL DIM aDimPoint[2] AS USUAL
4    aDimPoint[1] := "Hello"
5    aDimPoint[2] := "World!"
6    aOffsets := ArrayInit(2, @aDimPoint)
See Also