BCX Console Demonstration Program s139.bas

' ************************************************************************ 
' 12/29/2001  -- Thanks to Pat Kelly, BCX can now handle the passing of 
' arrays to SUBS and FUNCTIONS by reference.  The syntax is demonstrated 
' in this example.   Works for any type of array.   Enjoy! 
' ************************************************************************ 

DIM a[10] ' Array of 10 integers 

a[0] = 0
a[1] = 1
a[2] = 2
a[3] = 3
a[4] = 4
a[5] = 5
a[6] = 6
a[7] = 7
a[8] = 8
a[9] = 9

CALL MyNumArray(a, 10)

SUB MyNumArray (b[], nelem)
  DIM i AS INTEGER
  FOR i = 0 TO(nelem - 1)
    PRINT b[i]
  NEXT
END SUB

Result:

0
1
2
3
4
5
6
7
8
9