2013-01-15 1 views
0

훨씬 쉽지만, 간단한 mql4 함수에서 매개 변수로 2 차원 배열을 사용하고 요소를 삽입 할 수 없습니다. 문제가 어디 있는지 모르겠습니다.MQL4 - 함수의 매개 변수로 다차원 배열이 1 차원 배열로 삽입되었습니다.

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

를 컴파일 할 때,하지 실행할 때 오류가 발생, 그래서 그것이 작동 것이라 생각합니다. 시도해보기 :

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

int somenumber[5][5]; 
somenumber[0][0]=7; 
foo (somenumber); 
+0

내 코드가 붙여 넣기 하겠지만 어쩌면 내 질문이 미안합니다. 편집하려면 5 분을주세요. –

+0

이 문제는 ArrayCopy 함수와 더 관련이 있다는 것을 알고 있었기 때문에이 질문을 편집하는 대신 대답이 논리적 이었기 때문에 대답을 잘 수락하고 새로운 질문의 배열 복사본에 대해 물어 봅니다. –