how to set an array of built-in structures as function's return type?

 

Hi, Please take a look at the following code:

//+------------------------------------------------------------------+
//| Get an event description by its ID                               |
//| country_code: country code name (ISO 3166-1 alpha-2)             |
//+------------------------------------------------------------------+
MqlCalendarEvent[] CCalendar::EventsByCountry(const string country_code)
{
   MqlCalendarEvent events[];
   ResetLastError();
   int events_count = CalendarEventByCountry(country_code, events);
   if (!events_count > 0)
   {
      printf(__FUNCTION__ + ": unabe to fetch calendar date! error: " + IntegerToString(GetLastError()));
   }
   return events;
}

and more specifically to the function's header:

MqlCalendarEvent[] CCalendar::EventsByCountry(const string country_code);

I am aware of possibility to pass an array reference as function's parameter and modify that inside the function. But that's not what I am looking for this scenario.  How can I define the return type as an array of MqlCalendarEvents? Is that even possible in Mql5? 

Thank you in advance for your help. 

 
Zarik How can I define the return type as an array

You don't. The best you can do is return a class object that contains an array.