get variable address

 

Hi guys

 I want to get a variable address but I don't know how I can get that!

please help me how I can write this code

 
sayid Jafari: I want to get a variable address but I don't know how I can get that!

please help me how I can write this code

You can't get the variable's address in MQL! Are you maybe trying to pass a parameter by reference? Is that what you want?

Please explain your query or show same code that better explains what it is you are trying to achieve!

 

For exam 

int i;

what is the address of this variable in ram?

I think you are right we can not get that.


this code is for c#

                int a = 99;

                int* ptr = &a;

                int* ptr2 = ptr;

                MessageBox.Show($"Value of a is {*ptr}");

                MessageBox.Show($"Address of a is {(int)ptr2}");


But I don't know  what is code for mql

 
sayid Jafari:

For exam 

int i;

what is the address of this variable in ram?

I think you are right we can not get that.


this code is for c#

                int a = 99;

                int* ptr = &a;

                int* ptr2 = ptr;

                MessageBox.Show($"Value of a is {*ptr}");

                MessageBox.Show($"Address of a is {(int)ptr2}");


But I don't know  what is code for mql

MetaTrader uses MQL, not C#. There are no pointers in MQL. You can however pass parameters by reference.