0

もっと簡単だと思っていましたが、単純なmql4関数のパラメーターとして2次元配列を使用して要素を挿入することはできません。どこに問題があるのか​​わからない。

次のように宣言された関数があります。

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: コンパイル時ではなく、実行時に失敗します

4

1 に答える 1

0

I tried testing function with following signature and it compiles, so I think it will work. Give it a try:

int foo(int something[][])
{
   return (0);
}

int somenumber[5][5];
somenumber[0][0]=7;
foo (somenumber);
于 2013-01-15T03:40:54.257 に答える