0

I am writing a function to generate trail of all address who owned an asset ( assets is a mapping of asset no to owner no to address of owner). However while making array of address 'listofOwners' I get compilation error, Member "push" is not available in address[] memory outside of storage.

function viewTrail(uint256 _assetNo) public view returns(address[] memory){
   address[] memory listofOwners = new address[](assets[_assetNo].ownerNo);
  for(ownerNo = 1; ownerNo<= assets[_assetNo].ownerNo; ownerNo ++)
  {
  listofOwners.push(owneraddr[_assetNo][ownerNo]);
  }

return listofOwners;}

Can you please suggest a solution or some other code to generate trail of owners of an asset?

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.