pass an array to function

Blitz3D Forums/Blitz3D Beginners Area/pass an array to function

ZT(Posted 2004) [#1]
Hi

Quick question. Is there an easy way to pass a non-global array to a function, e.g.

dim b$(100,100)

myfunction(b$)
end

function myfunction(b$)
stuff
end function

which doesn't work.

Thanks


Rob Farley(Posted 2004) [#2]
Arrays are global, you don't need to pass them.


TartanTangerine (was Indiepath)(Posted 2004) [#3]
Took the words right out of my mouth.


ZT(Posted 2004) [#4]
ta, thanks for the quick reply


Beaker(Posted 2004) [#5]
You can pass 'blitz' arrays tho:

Local b$[4] ; has to be one dimensional

b[1] = 20
myfunction(b)

End

Function myfunction(c$[4])
;stuff
End Function

More info here:
http://www.blitzcoder.com/cgi-bin/code/code_showentry.pl?id=thechange09052002191420&comments=no