I know that is question has been answered in one form. However, I could not find an answer for my specific case.
Here is my code:
pragma solidity ^0.5.0;
contract Adoption {
address[16] adopters;
//Adopting a Pet
function adopt(uint petId) public returns (uint){
require(petId >= 0 && petId <= 15);
adopters[petId] = msg.sender;
return petId;
}
// Retrieving the adopters
function getAdopters() public view returns (address[16]){
return adopters;
}
}
Right now this is throwing a
TypeError: Data location must be "memory" for return parameter in function
but none was given error and the error is originating from
function getAdopters() public view returns (***address[16]***){
From my understanding, memory
is just a key word that creates a temporary variable. Do I need to use a storage
variable for the public address array?
I am going based off of this tutorial: https://truffleframework.com/tutorials/pet-shop
16
and you should be fine.