pragma solidity ^0.4.17;
contract Signature{
struct signature {
string value;
uint rate;
address sender_acc;
}
signature[5] public unverified_sig; // struct array is fixed but I want dynamic, if i del 5 then it
//gives error mentioned in the end
function add_signature(string rec_signature) public {
unverified_sig[0].sender_acc=msg.sender;
unverified_sig[0].value=rec_signature;
unverified_sig[0].rate=0;
}
}
Output Error: transact to Signature.add_signature errored: VM error: invalid opcode. invalid opcode The execution might have thrown. Debug the transaction to get more information.
Which version of Solidity do you use? I compiled with
0.5.0
in Remix. There isn't any problem with the dynamic array of struct. But there is a warning about the gas cost of the function that is too high which will exceed the gas limit.