Download MetaTrader 5

Assign array to local variable

To add comments, please log in or register
Do you know C++? MQL5 has much in common with it. Just try it yourself!
Alex
80
Alex 2015.09.21 05:33 

Hi,

Is it possible to assign an array to a local variable? I've tried the following but I get a "pointer cannot be used" error.

 

class Foo {

private:

   const double *high; 

public: 

   void Foo(const double &a_high) {

       high = a_high;

   }; 

} ;

Ex Ovo Omnia
3122
Ex Ovo Omnia 2015.09.21 07:40  
Alex:

Hi,

Is it possible to assign an array to a local variable? I've tried the following but I get a "pointer cannot be used" error.

 

class Foo {

private:

   const double *high; 

public: 

   void Foo(const double &a_high) {

       high = a_high;

   }; 

} ;

No, the only way I know of is wrapping the array into a class and passing an object in place of the array.
Alex
80
Alex 2015.09.21 14:36  
Ovo Cz:
No, the only way I know of is wrapping the array into a class and passing an object in place of the array.

Ok, Thanks Ovo Cz.

 

Annoying but I guess they have their reasons. 

To add comments, please log in or register