Qbasicnews.com

Full Version: Passing sprites and arrays through subs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright. I know I've been asking a lot of questions but this is my last one and I've got a project due next week.

How do you pass sprites and arrays through subs? I can do it with simple types such as integers, Strings, and doubles. But that's about it. Any help?
Just declare the array as a parameter, and then pass it as a normal parameter, with nothing between the ()s.

Code:
DECLARE SUB mySub (myArray () AS INTEGER)

DIM array (7) AS INTEGER

mySub array ()

SUB mySub (myArray () AS INTEGER)
   ' code and suff ...
END SUB
Hey wow! That's really simple. so the parameters for the sub recieving values are simply written as declarations... and the sub that passes to the recieving sub writes simply the values for those declared variables to be initialized to.

Cool :cool2: