In solidity I wonder if I can define an array that can store array of strut inside another array I have gave an example bellow.
[
[{id: 1, val: "val1"},{id: 2, val: "val2"},{id: 3, val: "val3"}],
[{id: 4, val: "val4"},{id: 5, val: "val5"},{id: 6, val: "val6"}],
]
Earlier I had a simple array using which I was just pushing single struct, but in that approach I have to pay gas fee for each array push
So I though if I can make a single list of multiple struct and call push method for that one array then I might be able to save a lot of gas.
I have tried achieving this using the snippet bellow but it doesn't work
struct Emp {
uint256 id;
string val;
}
Emp[][] public emprec;
function addEmpArr(Emp[][] memory arr) external {
emprec.push(arr);
}