I am trying to execute a contract provided as a tutorial for Remix at the following link: https://gangachris.com/posts/a-look-into-remix-ide/ The contract is:
pragma solidity ^0.4.20;
contract Cars{
struct Car{
bytes32 make;
unint year;
}
mapping(address => Car[]) public carOwners;
function registerCar(bytes32 _make, uint r) public {
carOwners[msg.sender].push(Car({ make: _make,
year: yr}));
}
function changeOwnership(address toOwner, uint index) public returns (bool){
if(carOwners[msg.sender].length == 0) {
return false;
}
if(carOwners[msg.sender].length > index + 1) {
return false;
}
carOwners[toOwner].push(carOwners[msg.sender][index]);
}
function getCarMake(address owner, uint index) public view returns (bytes32 carMake) {
if(carOwners[owner].length == 0) {
return;
}
if(carOwners[owner].length > index + 1){
return;
}
carMake = carOwners[owner][index].make;
}
}
I found by search that it’s a Remix problem and not associated with Solidity. Some body please guide me.
Zulfi.
constant
/view
.)push
is poor? If you're interested in doing so, I would recommend filing an issue in the Solidity repo on GitHub.