MQL4 - ArrayCopy - Copy a One-dimension Array to a Multidimensional Array Element

StackOverflow https://stackoverflow.com/questions/14333506

  •  15-01-2022
  •  | 
  •  

Pergunta

I want to copy an array "a", which is an array of doubles, into "as", which is an array of arrays of doubles. Don't know why, but I cant, Either I get compile-time errors or execute-time errors.

The code I have is:

double a [10];
double as [][10];

... I populate "a" and "as" with elements...

And now I want to copy "a" into "as", in the position #2.

I've tried several possible ways, like:

ArrayCopy(a[2],a);

But still I can't get it. Any idea?

Thanks.

Foi útil?

Solução

Since I've not found any other solution for this issue, I've finally coded my own function, using a nested FOR, so I insert the values of a 1-dimension array into the appropriate positions of the 2-dimension array.

That one has been the best solution for me.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top