I am passing a fixed array to a function where a dynamic array is expected.
addType([1,5, 2,5, 3,2, 4,2, 5,1], [6,1], [7,5]);
addType([1,5], [6,1, 2,5, 3,3], [7,5]);
function addType (
uint8[] memory _build,
uint8[] memory _input,
uint8[] memory _output
)
.......
I get an error when compiling
Invalid type for argument in function call. Invalid implicit conversion from uint8[10] memory to uint8[] memory requested
Found a solution in using a similar structure
uint8[] memory _build = new uint8[](10);
_build[0] = 1;
_build[1] = 5;
_build[2] = 2;
_build[3] = 5;
_build[4] = 3;
_build[5] = 2;
_build[6] = 4;
_build[7] = 2;
_build[8] = 5;
_build[9] = 1;
uint8[] memory _input = new uint8[](2);
_input[0] = 6;
_input[1] = 1;
uint8[] memory _output = new uint8[](2);
_output[0] = 7;
_output[1] = 5;
addType(_build, _input, _output);
But it is extremely not effective!
Help, please deal with these arrays!
Invalid type for argument in function call. Invalid implicit conversion from uint8[10] memory to uint8[] memory requested