I am trying to map an address to a struct object. While initializing the struct I get the following error: TypeError: Data location must be "storage", "memory" or "calldata" for variable, but none was given.
Here is my code:
//SPDX-License-Identifier: NONE
pragma solidity ^0.8.7;
contract DropSite {
uint public value = 123;
struct NFT_Owner{
string name;
uint nft_id;
}
mapping(address => NFT_Owner) public NFT_Ownership;
address[] public NFT_Owners;
function addValues( string memory _name, uint _nft_id) public {
NFT_Owner owner = NFT_Owner({name:_name , nft_id: _nft_id}) ;
NFT_Ownership[msg.sender] = owner;
NFT_Owners.push(0xdD870fA1b7C4700F2BD7f44238821C26f7392148);
}
}
and the error is: TypeError: Data location must be "storage", "memory" or "calldata" for variable, but none was given. --> contracts/Transfer.sol:15:7: | 15 | NFT_Owner owner = NFT_Owner({name:_name , nft_id: _nft_id}) ;
Anyone please help?