The type "array ptr" does not exist.
Therefore, it is not possible to pass/return an array pointer to/from a procedure.
(referring to your example, only a "double ptr" can be used, so that only one element of the array can be referenced by a pointer and not the entire array)
You can pass (by reference) a raw array to a procedure, but you can not return a raw array from a function.
To return an array created within a function, an example of workaround is to embed the array in a user-defined type (udt) to create a user object:
Code: Select all
type UDTarray
dim as double arr (any)
end type
function returnArr() as UDTarray
dim as UDTarray outUDT
redim outUDT.arr(0 To 2)
outUDT.arr(0) = 10.1
outUDT.arr(1) = 20.2
outUDT.arr(2) = 30.3
return outUDT
end function
dim as UDTarray newUDT = returnArr()
for i as integer = lbound(newUDT.arr) to ubound(newUDT.arr)
print i, newUDT.arr(i)
next