我认为它会更容易,但我不能在一个简单的mql4函数中使用二维数组作为参数并在其中插入元素。我不知道问题出在哪里。
我有一个声明如下的函数:
void insert_array_in_multi(double simple_array[], double &multi_array[][]){
...
ArrayResize(multi_array,1);
ArrayCopy(multi_array[x][0],simple_array); // Here I want to copy the one-dimension array into the multidimensional one, in "x" position. And here is where I get the ERROR when executing.
// I use "multi_array[x][0]" because is the way I don't get errors when compiling; if I use "multi_array[x]", meaning I want the one-dim array to be copied in the x pos of the multi-dim array, I get the error message "wrong dimension"
...
}
The other function calling this one, is like:
double bidiarray[0][10];
... as I put new elements, I resize the array to an array with 10 or more (primary) elements
... create a one-dimensional array like this:
double simple_array[10] = ...
... and then call to the previous function:
insert_array_in_multi(simple_array,bidiarray);
...
}
我得到的错误信息是“ArrayCopy函数的1个参数必须是数组”......但是,它是......不是吗?
有人知道怎么做吗?
提前致谢。
PD:执行时失败,而不是编译时
答案 0 :(得分:0)
我尝试使用以下签名测试功能并编译,所以我认为它会起作用。试一试:
int foo(int something[][])
{
return (0);
}
int somenumber[5][5];
somenumber[0][0]=7;
foo (somenumber);