Geeks Talk

Prepare for your Next Interview




diff between parameter passing by reference and passing by value

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?...


Go Back   Geeks Talk > Enterprise Solutions > Oracle Apps

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 04-24-2007
Junior Member
 
Join Date: Apr 2007
Location: banglore
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
nettyamraghu is on a distinguished road
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?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-24-2007
Moderator
 
Join Date: Sep 2006
Location: Delhi (India)
Posts: 866
Thanks: 12
Thanked 81 Times in 65 Posts
jainbrijesh is on a distinguished road
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.
Reply With Quote
  #3 (permalink)  
Old 04-25-2007
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 523
Thanks: 1
Thanked 55 Times in 46 Posts
sutnarcha is on a distinguished road
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-
Reply With Quote
  #4 (permalink)  
Old 04-25-2007
Contributing Member
 
Join Date: Mar 2007
Posts: 43
Thanks: 1
Thanked 2 Times in 2 Posts
varmakub is on a distinguished road
Re: diff between parameter passing by reference and passing by value

Excellent example !!! Its good one :-)
Reply With Quote
Reply

  Geeks Talk > Enterprise Solutions > Oracle Apps


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 12:48 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved