1
pragma solidity >= 0.5.0 < 0.7.0;

contract Adoption {
  address[16] public adopters;
 function getAdopters() public view returns(address[16]) {
   return adopters;

 }
 function adopt(uint petId) public returns(uint) {
   require(petId>=0 && petId<=15,"oops");
   adopters[petId] = msg.sender;
   return petId;

 }

}

The above script is showing me the below errors.

1.address[16] used in line 5 shows

Data location must be "memory" for return parameter in function, but none was given.

What is the fix?

0

Change this:

returns(address[16])

To this:

returns(address[16] memory)
| improve this answer | |

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.