
-----------------------------------
Clayton
Mon Apr 10, 2006 6:14 pm

pass arrays to modules?
-----------------------------------
hey, just wondering, is it possible to pass entire arrays to a module and have that module return the array (ex. in a sorting module). if its possible could u plz let me know how thnx

-----------------------------------
[Gandalf]
Mon Apr 10, 2006 6:18 pm


-----------------------------------
Hmm?  Unless I mistake your question, of course.

Modules are able to include procedures and functions which are in turn able to accept arrays as arguments.

-----------------------------------
Clayton
Mon Apr 10, 2006 6:20 pm


-----------------------------------
but how would you pass the array from a main program to a module without splitting an array up into different pieces (ex. 1 piece of info at a time)

-----------------------------------
[Gandalf]
Mon Apr 10, 2006 6:26 pm


-----------------------------------
The same way you would pass an array to a procedure or function:
var myGlobalArray : array 1 .. 3 of int := init (3, 4, 6)
proc putArray (localArray : array 1 .. * of int)
    for i : 1 .. upper (localArray)
        put localArray(i)
    end for
end putArray
putArray(myGlobalArray)
It works the same for a procedure in a module.

-----------------------------------
Clayton
Mon Apr 10, 2006 6:44 pm


-----------------------------------
oh ok thnx alot, talk about a brain fart lol
