Qbasicnews.com
September 20, 2020, 08:27:43 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Passing sprites and arrays through subs  (Read 1331 times)
bShumway
New Member

Posts: 6


« on: May 28, 2006, 04:44:58 PM »

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?
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #1 on: May 29, 2006, 07:41:48 AM »

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
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
bShumway
New Member

Posts: 6


« Reply #2 on: May 29, 2006, 02:15:12 PM »

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:
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!