You pass the array name by reference . . . for example . . .
double Array[]; double AnotherArray[]; ResizeArray(Array, 30); ResizeArray(AnotherArray, 200); void ResizeArray(double& ArrayToBeResized[], int NumberOfElements) { ArrayResize(ArrayToBeResized, NumberOfElements); }
blackkettle:
By the way, could you please show me another example on how to make a multi-dimension array function?
By the way, could you please show me another example on how to make a multi-dimension array function?
- You can only modify the first index of the array
#define SIZE 10 static double vHist[][SIZE]; ArrayResize(vHist, nHist); // array is now [nHist][SIZE]
If you want both indices to be dynamic, you have to do it yourself
int dim2; double arr[]; void setDim(int d1, int d2){ dim2=d2; arrayResize(arr, d1*d2); } void setArr(int d1, int d2, double v){ arr[d1*dim2+d2] = v; } double getArr(int d1, int d2){ return( arr[d1*dim2+d2] ); } : setDim(2,3); // looks like array[2][3] setArr(1,2,v) // looks like array[1][2]=v
WHRoeder:
- You can only modify the first index of the array
If you want both indices to be dynamic, you have to do it yourself
Thank you so much, WHRoeder!
Your code is great!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Excuse me,
I was wondering whether anyone superior here could enlighten me.
Is it possible to make a user-defined array function?
If it could be done, we must be able to transfer the array name as a parameter to the function.
Could someone give me an example?
Thank you so much!