How to use getter and setter methods in struct variables?

midhun0003midhun0003 Member Posts: 15
Following is the code for my contract , i need to store a set of values into structure variable arrays but its always returning zero or default values.
Please help
contract Test{
struct coinWallet {
uint redCoin;
uint greenCoin;
}

mapping (uint => coinWallet) myWallet;
function set(uint no,uint a,uint b){
myWallet[no].redCoin = a;
myWallet[no].greenCoin =b;

}

function GetRed(uint nos) returns (uint redAmount,uint greenAmount){
redAmount =myWallet[no].redCoin;
greenAmount=myWallet[no].greenCoin;

}
}

Comments

Sign In or Register to comment.