Passing a whole array to a function

Blitz3D Forums/Blitz3D Programming/Passing a whole array to a function

Blitzplotter(Posted 2010) [#1]
Hello. I want to send a whole array to a function as opposed to a single member from an array - is this possible ?

[EDIT]

Easier than I thought:-




Charrua(Posted 2010) [#2]
use BlitzArray's, the ones defined by: [] not by (), they must be unidimensional ones. They should be fields in a Typed variable also.

(they are passed by ref, so any changes in the function actually changes the original array passed, if i'm not wrong, give me a minute to do some tests...


Charrua(Posted 2010) [#3]
try this:

Local myArray[9]
Local i

For i=0 To 9
	myArray[i]=i
Next

Print "myArray before"
For i=0 To 9
	Print myArray[i]
Next


AddOne(myArray)

Print
Print "myArray after"
For i=0 To 9
	Print myArray[i]
Next

WaitKey

End

Function AddOne(a[9])
	Local i
	
	For i=0 To 9
		a[i] = a[i]+1
	Next

End Function

hope that helps

Juan


Blitzplotter(Posted 2010) [#4]
Thanks for the feedback, very much appreciated.