This post (When should I use calldata and when should I use memory?) explains the differences between calldata and memory. However where are function arguments or variables within functions stored if nothing is specified aka what is the default for each?


function foo(string _exampleString) // where is the argument stored?


function foo(string memory _exampleString)


function foo(string _exampleString) public{
   uint256 memory bar = 1;


function foo(string _exampleString) public {
    uint256 bar = 1;   // where is the argument stored?

1 Answer 1


As you can read on this documentation function arguments are always in memory. So both options will store the value on memory.

  • that doesn't really answer my question. My question is why would you specify memory to a function argument if its the default place to be stored? why would you speciy calldata explicitly? Besides funciton arguments can also be stored in storage Nov 12, 2021 at 15:20

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.