2

I used the following code

interface test{
  function testfunction(uint[20] memory P, uint[20] memory Q) external returns(uint,bool,uint);
}

It gives the error Location has to be calldata for external functions (remove the "memory" or "storage" keyword)

and when I changes it to

interface test{
  function testfunction(uint[20] calldata P, uint[20] memory Q) calldata returns(uint,bool,uint);
}

It gives error Expected ',' but got identifier function , so what is the correct way declare this in interface, and also how to call that function from inside a function of same contract. please reply for the same solidity version.

3
  • The error-message tells you remove the "memory" or "storage" keyword. Why not just follow it??? Jan 3, 2021 at 13:40
  • "how to call that function from inside a function of same contract" - declare it public instead of external (and of course, in the contract itself, not in the interface). Jan 3, 2021 at 13:41
  • when I removed the keyword calldata it worked, Thank You
    – ashwin
    Jan 3, 2021 at 13:47

0

Your Answer

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

Browse other questions tagged or ask your own question.