HTBasic Help
×
Menu
Index

DIM

Dimensions REAL arrays and strings.
 
 DIM item [,item...]
 
Usage:
DIM A(100),B(10,10),C(4,2,5,8)
DIM A$[200],B$(6,10)[100]
DIM Array(-64:63,8)
DIM Hold$[365] BUFFER, Array(200) BUFFER
 
Example: DIM.BAS
 
Description:
The DIM statement is used to declare REAL numeric array and string variables. The maximum number of array dimensions is six and the lower bound must be less than or equal to the upper bound value. Each dimension may contain a maximum of 32,767 elements. The default dimension of an undeclared array is the number of subscripts found in its first occurrence, with each dimension having the default lower bound of the value declared in OPTION BASE and an upper bound of ten.
 
Each numeric array element is REAL and requires eight bytes of storage. Strings require one byte of storage per character, plus two additional bytes. To declare a variable a BUFFER, follow its name with the BUFFER keyword. BUFFER variables are used with the TRANSFER statement.
 
Any number of DIM statements are allowed, anywhere in the program; however, a DIM statement may not appear before an OPTION BASE statement. Memory allocation is made during prerun and cannot be dynamically deallocated. However, the dimensions can be changed in a limited way by REDIM. Use ALLOCATE and DEALLOCATE for dynamic memory allocation.
 
See Also: