I've two contracts deployed one is UserRegistration
and another is Exam
I've getUser(uint id)
method to fetch data of particular user using users
mapping,
function getUser(uint _id) public constant returns(uint,string,string,uint,uint) {
User memory c = users[_id];
return(
c.id,
c.name,
c.class,
c.age,
c.pincode);
}
Now, I've another contract Exam
in which I want to call getUser()
function from UserRegistration
contract so, I've done it like this,
pragma solidity 0.4.25;
contract UserRegistration
{
function getUserCount() public returns(uint);
function getUser(uint) public returns(uint,string,string,uint,uint);
}
contract Exam
{
address private addrUsr;
uint public count;
UserRegistration r;
constructor(address _addrUsr)
{
addrUsr=_addrUsr;
r = UserRegistration(addrUsr);
}
function updateCount() public {
count=r.getUserCount();
}
function getUserData(uint _id) public
{
//WHAT to do HERE//;
}
}
But, how to parse the values returned by getUser()
function into getUserData()
so that if I call getUserData()
function it should return all the values returned by getUser()
, and as the values returned by getUser()
function are of different data type I can't store them in an array.
Please help me