10

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)
    public
    view
    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?

pd176
  • 439
  • 4
  • 14

2 Answers2

6

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.

Soham Lawar
  • 2,567
  • 14
  • 38
0

I think it is used to specify where the value is stored and when we make it memory it means that it will be put in temporary loc and will be there until the function is executed