This answer shows that we can return all the addresses (from address[] public
) as a single array of addresses:
function getAddresses() constant returns (address[]){ return MemberAddresses; }
Instead of address[] public MemberAddresses
; if we have mapping(address => uint) MemberAddresses;
contract AddressList {
mapping(address => uint) MemberAddresses;
function registerAddress(uint var) {
MemberAddresses[msg.sender] = var;
}
}
[Q] Can we return all the addresses inside mapping, as a single array of addresses?
Thank you for your valuable time and help.