Is there any way I can use a local parameter within multiple functions? The idea is to save gas when calling functions. A parameter wouldn't have to be copied and be returned every time.

Here's some pseudo code:

function A(uint[] array) public pure returns (uint[]) {
    B(*array);  // send a memory pointer?
    return array;    

// B directly manipulates the array via the pointer => see no return value
function B(uint[] *array) internal pure {
    // something
  • 3
    I am not sure if I understood you correctly, but as far as I have understood arrays are not copied between function calls, as they can contain millions of elements. They are passed by a reference. Somebody correct me if I am wrong. May 31, 2018 at 20:41
  • You're right. I was interpreting the Remix debugger wrong. Thanks.
    – Chris
    Jun 1, 2018 at 14:39

1 Answer 1


This is solved as Mikko explained in the comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.