Access array by reference - how to?
Shane De Catania
Posts: 67
Hi All,
This is almost certainly a silly question with an obvious answer... How do I access the elements of an array passed by address to a function?
I want to do something like this...
I found something like y := LONG[noparse][[/noparse]array_ptr+4] did work, but that seems rather long winded. What is the best way to read (and write) individual elements
from an address pointer?
Thanks in advance.
Cheers,
Shane
Post Edited (Shane De Catania) : 4/19/2007 4:54:44 AM GMT
This is almost certainly a silly question with an obvious answer... How do I access the elements of an array passed by address to a function?
I want to do something like this...
VAR LONG my_array ... PUB MAIN AccessArray(@my_array) ... I want to access the array by reference- This could be in a different cog... PUB AccessArray(array_ptr) | x, y, z x := array_ptr[noparse][[/noparse]0] ' Doesn't work y := array_ptr ' z := array_ptr ' ...
I found something like y := LONG[noparse][[/noparse]array_ptr+4] did work, but that seems rather long winded. What is the best way to read (and write) individual elements
from an address pointer?
Thanks in advance.
Cheers,
Shane
Post Edited (Shane De Catania) : 4/19/2007 4:54:44 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.