pragma solidity 0.4.24; contract Template { struct Pet { string name; uint age; } Pet[] public pets; function addPet(string name, uint age) public { pets.push(Pet(name, age)); } function changePet(uint petId, string name, uint age) public { Pet storage temp = pets[petId]; temp.name = name; temp.age = age; } function getPet(uint petId) public view returns (string, uint) { return (pets[petId].name, pets[petId].age); } }
0.4.24