Tuesday, March 27, 2012

Where is pass by reference is useful?

1.
Suppose you have large object to pass to a function, better to pass by reference instead of passing bye value or the object itself.

2.
Least Memory Management.

3.
No 0 values possible -> Called function will know that the object have been created and you are passing address of that object.

4.
New variable are not created, rather already created objects or variable are used.

5.
We can return multiple values from a function.

6.
It allows us to have the function change the value of the argument, which is sometimes useful.

7.


more practical reason will come soon ......

No comments:

Post a Comment

Live

Your Ad Here