Passing Arrays? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Passing Arrays? (/thread-8022.html) |
Passing Arrays? - toml_12953 - 03-24-2017 03:40 PM I'm trying to fill an array in a subprogram. I always get back zeros. What am I doing wrong? Are the parameters passed by value only? If so, is there a way to pass them by reference? TIA Tom L Code: SET_CONIC( COEF, A, B ) RE: Passing Arrays? - Han - 03-24-2017 03:47 PM Both C and COEF are local variables, and therefore their context is restricted to only the subprograms that declare them. Variables are passed by value. Either declare a local variable outside of the context of the subprograms to hold the coefficient values, or modify your subprogram to return the modified coefficients. For example: Code: // set values of conic coefficient array or Code:
RE: Passing Arrays? - toml_12953 - 03-24-2017 05:23 PM (03-24-2017 03:47 PM)Han Wrote: Both C and COEF are local variables, and therefore their context is restricted to only the subprograms that declare them. Variables are passed by value. Thanks! I chose the above method. Tom L RE: Passing Arrays? - cyrille de brébisson - 03-28-2017 05:58 AM Hello, Variables are always passed by value. Sorry. Cyrille |