Download MetaTrader 5
To add comments, please log in or register
How to earn at MQL5.community? Come and find out!
balazs321
168
balazs321 2011.09.24 11:24 
I'm just wondering that is it possible to get an array's name (identifier) that was passed to a function? For example:
int ThisIsMyArray[10];

string MyFunction(int &array[]) {
   return(???);
}

void OnInit() {
  Print(MyFunction(ThisIsMyArray)); //This should output "ThisIsMyArray"
}
Any ideas? I would like to use it for debugging purposes. (Generating a warning with the array's name in it)
balazs321
168
balazs321 2011.09.24 12:05  
Well, I guess that it's impossible, because the code is translated into machine code, hence variable names cannot be retrieved. But tell me if I'm wrong.
Rashid Umarov
Admin
11709
Rashid Umarov 2011.09.24 13:05  
It's impossible. You cann use __Function__.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
Standard Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions - Documentation on MQL5
balazs321
168
balazs321 2011.09.24 14:31  
Okay, thanks Rosh!
/
To add comments, please log in or register