Return array in function

 

HI, 

 

I am trying return a MQLRates array in my function, but I get a error: 

class TradeLibrary

{

   private:

      MqlRates rates[]; 

   public:

      MqlRates getRates(); 

}; 

 

MqlRates TradeLibrary::getRates()

{

   return rates;  // this don't works

} 
 

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


 
evertonalex:

HI, 

 

I am trying return a MQLRates array in my function, but I get a error: 

You can't return an array. Please read the documentation :

The return operator can return the value of an expression located in this operator. If necessary, the expression value is converted to the function result type. What can be returned: simple types, simple structures, object pointers. With the return operator you can't return any arrays, class objects, variables of compound structure type.

Reason: