this is my code:
struct Entity{
address _address;
uint data;
}
Entity[] entityArray;
function addEntityArray(uint _data) public returns(uint){
entityArray.push(Entity((msg.sender), _data));
return entityArray[(entityArray.length) - 1].data;
}
to update a struct in this array at any point in time, i will need to keep track of the address and the index of it using MAPPING right? or i have to loop everytime which is costly in gas... how to tackle this issue in the best way possible?