void b (int c){ c=50; }Pass c by reference. Perhaps you should read the manual.
MQL4 Reference -> Language Basics -> Functions -> Passing Parameters - Functions - Language Basics - MQL4 Reference
whroeder1:
Pass c by reference. Perhaps you should read the manual.
Passing Parameters - Functions - Language Basics - MQL4 Reference
can you show me the code to make a=50? In the examples you showed me the functions only return 1 value, you can see the examples don't use void in functions examples, but i need each function to return several values, do you know a way to do it?
Pass c by reference. Perhaps you should read the manual.
Passing Parameters - Functions - Language Basics - MQL4 Reference
Mrluck07:
can you show me the code to make a=50? In the examples you showed me the functions only return 1 value, but i need each function to return several values, do you know a way to do it?
can you show me the code to make a=50? In the examples you showed me the functions only return 1 value, but i need each function to return several values, do you know a way to do it?
void b (int& c) { c=50; }PS: a function (any function) can not return several values. Pass multiple parameters by reference and that way you can have multiple values set (changed) by the function - almost the same as if it returned several values
Mladen Rakic:
Now it worked exactly as i needed
Thanks a lot for the tip
Mrluck07:
Now it worked exactly as i needed, so what the & about? Thanks a lot for the tip
That is the "by reference" (here is one more general (non-mql) example and an explanation what does it mean) : https://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value
Now it worked exactly as i needed, so what the & about? Thanks a lot for the tip

What's the difference between passing by reference vs. passing by value?
- stackoverflow.com
a parameter passed by reference a parameter passed by value? Could you give me some examples, please?
Mladen Rakic:
That is the "by reference" (here is one more general (non-mql) example and an explanation what does it mean) : https://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value
Great, now i understand it more, this & thing wasn't on mql4 book, have a nice day sir
That is the "by reference" (here is one more general (non-mql) example and an explanation what does it mean) : https://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, i need help once more, i never worked with functions before, but when the code starts to increase you have to use them, or you get spaghetti code, i need help to get more than 1 returned value from each function, it's possible to do it? I've been searching, you can use something like passing by reference, so you can set a variable from the main code, and it will be passed to a selected function, but i'm getting an error in the code:
I get comment value at 0, but shouldn't it be 50? How can i make this work. Thanks for any help