Size of an Array
ARRAYSIZE(array)
ARRAYSIZE(array,mode)
The function returns the index of the last element of an array of an arbitrary typ. Normally the last index of an equivalent one dimensional array is return. With different values of mode one can get the index of the last row index or the last column.
DIM | arraysize(a) | arraysize(a,1) | arraysize(a,2) |
(no DIM) | 0 | 0 | 0 |
DIM a[5] | 5 | 5 | 0 |
DIM a[3,4] | 19 | 3 | 4 |
This function is especially useful in procedures, where the size of an array, given as parameter, may differ:
proc setarray var a[],val
for i=0 to arraysize(a)
a[i]=val
next
endp |
|