Arrays
i haven't been able to try this yet (still waiting on my propeller shipment), but i was wondering if it's possible to pass arrays in/out of methods?
for example, if "a" is an array, "fido" is the object name, and "Catch" is a public method of "fido" then would the calling statement be: fido.catch(@a)?
i'm presuming references are used to pass arrays around, but i'm uncertain about the syntax used to dereference the arrays once they are passed into or out of a method or if this is even possible?
regards,
bryce
for example, if "a" is an array, "fido" is the object name, and "Catch" is a public method of "fido" then would the calling statement be: fido.catch(@a)?
i'm presuming references are used to pass arrays around, but i'm uncertain about the syntax used to dereference the arrays once they are passed into or out of a method or if this is even possible?
regards,
bryce
Comments
Passing the address of a variable (or block of them) is useful for letting one process (cog) update variables for another -- one process simply passes the address of the variable(s) it wants the other to have access to. This is possible because all Spin variables reside in main RAM.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
test.spin contains the "Main" public method that initializes array "a" and passes it into the "fido.Catch" method as a pointer or reference. the arrays i wish to use contain floating-point numbers.
the "a" array will then be manipulated to obtain another array, let's call it "b", and this will be passed out of the method back to "Main".
i finally obtained my propeller, but debugging does not yield the expected results. i don't think i'm dereferencing the arrays correctly!
any ideas?
Post Edited (brs) : 5/15/2006 3:37:15 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Could you please explain the significance of declaring b[noparse][[/noparse]20] as a variable in the fido.spin file. why make this a permanent variable?