hknight:
That does not work either.
So there is no good way for a function to return an array?
Of course it doesn't work . . .
RaptorUK:
You aren't trying to return an array though, are you ? aren't you just trying to return the element as specified in the value passed to the function ? I'm guessing because you haven't said what you are trying to achieve.
You can't return an array from a function.
hknight: How can I alert values from an array created by a function?
Your code - Not passing arguments, trying to return an array. | Try this. |
---|---|
Alert(XYZ[1]); // Should alert 4.56 double XYZ(string y, int z) { double x[3]; x[0] = 0.123; x[1] = 4.56; x[2] = 7.89; return(x); } | double arr[3]; XYZ(arr, "a", 0); Alert(arr[1]); // Should alert 4.56 void XYZ(double& x[], string y, int z){ // x by reference // double x[3]; x[0] = 0.123; x[1] = 4.56; x[2] = 7.89; return; //(x); } |
Perfect, thanks!
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
How can I alert values from an array created by a function?