BCX Console Demonstration Program s117.bas

' *************************************************** 
'  Demonstrates how to modify arrays that have been 
'  passed to SUBS and FUNCTIONS as parameters 
' *************************************************** 

DIM x![3]
DIM y![3]
DIM z![3]

x![0] = 2.1
x![1] = 3.2
x![2] = 4.3

y![0] = 3.1
y![1] = 4.2
y![2] = 5.3

Multp(&x![0], &y![0], &z![0], 3)

DIM i

FOR i = 0 TO 2
  ?  (FLOAT)z![i]
NEXT i

SUB Multp (a![], b![], C![], count)
  LOCAL n
  FOR n = 0 TO count-1
    C[n] = a![n] * b![n]
  NEXT n
END SUB

Result:

6.509999
13.44
22.79