Passing a whole array to a function
Blitz3D Forums/Blitz3D Programming/Passing a whole array to a function
| ||
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:- ![]() |
| ||
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... |
| ||
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 |
| ||
Thanks for the feedback, very much appreciated. |