By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,009 Members | 1,643 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,009 IT Pros & Developers. It's quick & easy.

difference between pass by address and pass by reference

P: 1
can any one help me regarding my proble that what is diffrence between pas by address and pass by refernce
Aug 14 '07 #1
Share this Question
Share on Google+
3 Replies


Meetee
Expert Mod 100+
P: 931
can any one help me regarding my proble that what is diffrence between pas by address and pass by refernce
Please google this topic and you will find many sites discussing this topic.

Regards
Aug 14 '07 #2

weaknessforcats
Expert Mod 5K+
P: 9,197
The short answer is:

Pass by Value: A copy of the variable is made for the function argument. The function makes changes to the copy which is destroyed when the function completes.

Pass by Reference: A copy of the variable is not made. The function argument name becomes an alias for the variable used on the call. By changing the alias, the function is changing the original.

C has only pass by value.
C++ has both pass by vaue and pass by reference.
Aug 14 '07 #3

Expert 10K+
P: 11,448
On top of what WeaknessForCats wrote: there is no 'pass by address' mechanism.
It's either a pass by value or pass by reference parameter passing mechanism
and addresses of objects can be passed using one of these parameter passing
mechanism.

If C didn't allow for an 'address of'' operator it would've been quite a silly language.

kind ergards,

Jos
Aug 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.