I'm using the remix IDE.I want to define the size of the array at the time constructor is called. Someone please help. This is what I tried :
pragma solidity >=0.7.0 <0.8.0;
contract Vote
{
struct Proposal
{
uint votecount;
}
Proposal[] proposal;
constructor(uint no)
{
proposal=new Proposal[](no);
}
}
Error: UnimplementedFeatureError: Copying of type struct Vote.Proposal memory[] memory to storage not yet supported. Another :
pragma solidity >=0.7.0 <0.8.0;
contract Vote
{
struct Proposal
{
uint votecount;
}
Proposal[] proposal;
constructor(uint no)
{
for(uint i=0;i<no;i++)
proposal.votecount.push(0);
}
}
Error: TypeError: Member "votecount" not found or not visible after argument-dependent lookup in struct Vote.Proposal storage ref[] storage ref. proposal.votecount.push(0); ^----------------^