Tell me why the error occurs: "'buffer' - parameter conversion not allowed"

 
struct signal
  {
   char              id[36];
   char              symbols_name[20];
   double            stop_loss;
   double            open_price;
   bool              type;
   int               timestamp;
  };
//todo 

void OnTimer()
  {
   signal buffer[];
   
   signalRead(buffer);
  }


void signalRead(signal& buffer)
  {

//todo
      ulong file_size = FileSize(file_handle);
      uint parts = file_size / SIZE_SIGNAL;
      ArrayResize(buffer,parts);

//todo
  }
For some reason, it swears at the line
ArrayResize(buffer,parts);

with the error buffer - parameter conversion not allowed when I try to pass an array of structures by reference to a function signalRead


But the code works fine if I declare  signal buffer[] inside the function signalRead

WORKS!

void signalRead()
  {
signal buffer[];
//todo
      ulong file_size = FileSize(file_handle);
      uint parts = file_size / SIZE_SIGNAL;
      ArrayResize(buffer,parts);

//todo
  }

Why do I get an error when I pass an array of structures by reference please explain?

 

By convention an array must be passed by reference, and is indicated with brackets []. So, the function prototype needs to look like this:

void signalRead(signal& buffer[])

A declaration like yours

void signalRead(signal& buffer)

would mean buffer is a single signal struct, passed by reference, hence the error.

 
lippmaje:

By convention an array must be passed by reference, and is indicated with brackets []. So, the function prototype needs to look like this:

A declaration like yours

would mean buffer is a single signal struct, passed by reference, hence the error.

This is when I wish there was a like function or the most common mistake and the likes or up votes would guide people the most up votes for the subject matter would be on top..
 
lippmaje:

By convention an array must be passed by reference, and is indicated with brackets []. So, the function prototype needs to look like this:

A declaration like yours

would mean buffer is a single signal struct, passed by reference, hence the error.

Thank you very much! such a banal mistake, the issue is resolved!
Reason: