BCX Console Demonstration Program s138.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 strings 
 
 a$[0] = "zero"
 a$[1] = "one"
 a$[2] = "two"
 a$[3] = "three"
 a$[4] = "four"
 a$[5] = "five"
 a$[6] = "six"
 a$[7] = "seven"
 a$[8] = "eight"
 a$[9] = "nine"
 
 CALL MyStrArray(a$, 10)
 
 SUB MyStrArray( b$[], nelem)
   DIM i AS INTEGER
   FOR i = 0 TO(nelem - 1)
     PRINT b$[i]
   NEXT
 END SUB

Result:


 zero
 one
 two
 three
 four
 five
 six
 seven
 eight
 nine