| xHarbour Reference Documentation > Function Reference |  | 
|  |  |  | 
Changes the number of elements in an array.
ASize( <aArray>, <nCount> ) --> aArray
The function returns the reference to <aArray>.
The array function ASize() is used to dynamically increase or decrease the size of <aArray> to <nCount> elements. When the array is enlarged, new elements are added to the end of <aArray> and are initialized with NIL. When the number of elements is decreased, they are removed from the end of <aArray>. The values in the removed elements are lost.
The size of arrays is limited by the memory resources of the operating system.
| See also: | AAdd(), ADel(), AFill(), AIns(), ASizeAlloc() | 
| Category: | Array functions | 
| Source: | vm\arrayshb.c | 
| LIB: | xhb.lib | 
| DLL: | xhbdll.dll | 
// This example demonstrates the use of the ASize function.
// It increases and decreases the size of an array.
   PROCEDURE Main()
      LOCAL aArray := { 45 }
      ? Len( aArray )                    // result: 1
      ASize( aArray, 3 )
      ? Len( aArray )                    // result: 3
      ? aArray[1], aArray[2], aArray[3]  // result: 45 NIL NIL
      ASize( aArray, 1 )
      ? Len( aArray )                    // result: 1
      ? aArray[1]                        // result: 45
   RETURN
http://www.xHarbour.com