I am giving the values to structure field through Remix IDE, then I am putting ‘0’ as the index of people array, then I click transact and then I click call, but Remix does not show me the value I gave as input to the structure fields (encircled in blue box). However, previously it worked: Understanding array of structure The code is:
pragma solidity 0.5.4;
contract MyContractOwnerAddr {
uint256 public peopleCount = 0;
mapping(uint => Person) public people;
address owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
struct Person {
uint _id;
string _firstName;
string _lastName;
}
constructor() public {
owner = msg.sender;
}
function addPerson(
string memory _firstName,
string memory _lastName)
public
onlyOwner
{
incrementCount();
people[peopleCount] = Person(peopleCount, _firstName, _lastName);
}
function incrementCount() internal {
peopleCount += 1;
}
}
Some body please guide me.