Prepare for your Next Interview
This is a discussion on diff between parameter passing by reference and passing by value within the Oracle Apps forums, part of the Enterprise Solutions category; wat is difference between parameter passing by reference and parameter passing by value? and example?...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
diff between parameter passing by reference and passing by value
wat is difference between parameter passing by reference and parameter passing by value? and example?
|
| Sponsored Links |
|
|||
|
Re: diff between parameter passing by reference and passing by value
Parameters passing by reference means we are directly passing the memory address where value is saved.
Parameters passing by value means we are passing the parameter value only. check this link for a better example. http://www.cs.princeton.edu/~lworthi...s_val_ref.html
__________________
Brijesh Jain brijesh.tester@yahoo.co.in http://softwaretestingexpertise.blogspot.com Last edited by jainbrijesh : 04-24-2007 at 10:03 AM. |
|
|||
|
Re: diff between parameter passing by reference and passing by value
Parameter passing by value means only a value is passed to the function and any changes to the parameters doesn’t change the original arguments passed to the function.
Eg main() { int a=10,b=20,c=0; c=func(a,b); // pass by value print a // prints 10 print b // prints 20 }; func(int x,int y) // recieves values 10 & 20 { x=x+1; // adds 1 to x y=y+1; // adds 1 to y print x; // prints 11 print y; // ptints 21 } Parameter passing by reference means the address of the original arguments are passed to the function and any changes to the parameters change the original arguments also. Eg main() { int a=10,b=20,c=0; c=func(&a,&b); // pass by reference print a // prints 11 print b // ptints 21 }; func(int *x,int *y) // recieves references to a & b { *x=*x+1; // adds 1 to a *y=*y+1; // adds 1 to b print *x; // prints a as 11 print *y; // prints b as 21 }
__________________
Lack of WILL POWER has caused more failure than lack of INTELLIGENCE or ABILITY. -sutnarcha- |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pass dynamic value to a parameter | Geek_Guest | LoadRunner | 2 | 01-07-2008 01:56 AM |
| diff | vmshenoy | Networking | 5 | 02-01-2007 02:11 AM |
| Process of using parameter and variable | JobHelper | Data Warehousing | 0 | 01-09-2007 05:31 AM |
| diff b/w AWT and Swing | vmshenoy | Java | 2 | 01-05-2007 06:06 AM |
| Diff in using Virtual Obj wiz and GUI Spy | bvani | Test Cases | 1 | 05-29-2006 11:08 AM |