![]() |
|
Pass an array as a parameter? - Printable Version +- Boriel Basic Forum (https://forum.boriel.com) +-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://forum.boriel.com/forumdisplay.php?fid=16) +---- Thread: Pass an array as a parameter? (/showthread.php?tid=317) |
Pass an array as a parameter? - LTee - 2011-02-24 A question today, rather than a bug. :-) Is it possible to pass an array as a parameter to a function or a sub? And if so, does the function/sub receive a copy of the array or a pointer to the original? i.e. if I made changes to the array within a function, would those changes be local to the function or would they also be visible from the calling method? Re: Pass an array as a parameter? - boriel - 2011-02-24 LTee Wrote:A question today, rather than a bug. :-)Not yet. This is something "in the queue". Most deep code refactoring (like the new preprocessor and so on) are oriented to such things. Please, be patient... Arrays will be pased like strings (pointers to the HEAP). Re: Pass an array as a parameter? - LTee - 2011-02-24 That sounds ideal. Thanks for the prompt response! I suspected it might not be in there yet, but wanted to check that I wasn't just messing up the syntax. :-) Re: Pass an array as a parameter? - boriel - 2011-02-24 LTee Wrote:That sounds ideal. Thanks for the prompt response!First thing first: ZX BASIC will allow dynamic arrays (Sinclair BASIC compatible). Later, the compiler will allow them be passed via parameters. Then use Lbound() and Ubound() to get the Dims... |