Author |
Message |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Mon Apr 10, 2006 6:14 pm Post subject: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Mon Apr 10, 2006 6:18 pm Post subject: (No subject) |
|
|
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. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Mon Apr 10, 2006 6:20 pm Post subject: (No subject) |
|
|
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) |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Mon Apr 10, 2006 6:26 pm Post subject: (No subject) |
|
|
The same way you would pass an array to a procedure or function:
code: | 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. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Mon Apr 10, 2006 6:44 pm Post subject: (No subject) |
|
|
oh ok thnx alot, talk about a brain fart lol |
|
|
|
|
![](images/spacer.gif) |
|