+ 4
You can have a look on out keyword too. https://code.sololearn.com/chjJvW4qN1KE/?ref=app
6th Jun 2018, 1:56 PM
Yusuf
Yusuf - avatar
+ 3
ref(reference) is like & in C/C++.
5th Jun 2018, 3:17 PM
Alihuseyn Kengerli
Alihuseyn Kengerli - avatar
+ 2
Here is the example: https://code.sololearn.com/c9y7QQ8u3d1k/?ref=app In the first function, we set the value of a to 10, but when we back to main function we see that a is still 5. It is because the changes made in the function doesn't save to the variable. The parameter just took the value of a. But in second function, we passed the real a as the parameter, and the changes made to the a is really effected a.
5th Jun 2018, 3:01 PM
Yusuf
Yusuf - avatar