| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Creates an uninitialized array of specified length.
Array( <nDim1> [, <nDimN,...>] ) --> aArray
The function returns an array dimensioned according to the passed parameters. All elements of the array contain the value NIL.
Array variables are usually initialized within a variable declaration. The Array() function allows for creating arrays programmatically outside a variable declaration. Array() can be part of an expression or can be called from within a code block.
The return value of Array() is a reference to an array of the specified dimensions. The number of elements in the array is limited by memory resources of the operating system.
| See also: | AAdd(), AClone(), ACopy(), ADel(), AEval(), AFill(), AIns(), Hash() |
| Category: | Array functions |
| Source: | vm\arrayshb.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates different approaches of creating
// uninitialized arrays.
PROCEDURE Main()
LOCAL xValue
LOCAL aArray[2,3] // declaration
xValue := Array( 3, 5 ) // programmatically
? Len( aArray ), Len( aArray[1] ) // result: 2 3
? Len( xValue ), Len( xValue[1] ) // result: 3 5
RETURN NIL
http://www.xHarbour.com