What does the memory keyword in the argument of a function do?

pragma solidity 0.4.24;
pragma experimental "ABIEncoderV2";

contract Conditional {
struct Condition {
    address to;
    bytes4 selector;
    bytes parameters;
    bytes32 expectedValueHash;
    bool onlyCheckForSuccess;

 function isSatisfied(Condition memory condition)
    returns (bool)
    if (condition.onlyCheckForSuccess) {
      return assertNotFails(condition);
    } else {
      return assertReturnsExpectedResult(condition);

I understand what the memory keyword does. But what does it mean in the context of a function argument?


If you don't specify storage type of a function argument then function arguments are always in memory and you are passing an argument to a function by value.

When you are explicitly defining storage type of an argument asstorage you are passing an argument to a function by reference.

  • 1
    What is the purpose to specify a function argument as "memory" if all function arguments are by default "memory". It not redundant?
    – Deniz
    Jul 28 '19 at 17:17
  • @Deniz, yes it is redundant. Jul 30 '19 at 4:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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