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?

1 Answer 1


Change this:


To this:

returns(address[16] memory)

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.