User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Computer Science and Software Design section within the Software Development category of DaniWeb, a massive community of 361,899 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,379 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Computer Science and Software Design advertiser:
Views: 5261 | Replies: 2
Reply
Join Date: Apr 2005
Posts: 3
Reputation: Potsuki is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Potsuki Potsuki is offline Offline
Newbie Poster

Help Passing Variables/Parameters - By Ref/Value?

  #1  
May 27th, 2005
Hi there

I wonder if anyone can help out a newbie. I am trying to understand the difference between passing variables by reference or value. This is what I understand so far:

1. Passing parameters by value is when the variable is copied into the parameter list of a function or procedure. The value is independent and remains unchanged when passed.

2. Passing parameters by reference is when a value being passed is linked to the original value. THis means that the original value can be altered.

I am not sure on what occasion you would use what and for what reasons...I would be really grateful if someone could explain this to me...

Thanks in advance!

Potsuki
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2005
Posts: 13
Reputation: frankcs is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
frankcs frankcs is offline Offline
Newbie Poster

Re: Passing Variables/Parameters - By Ref/Value?

  #2  
May 28th, 2005
hi potsuki
well........almost all exams of c or programming
language had asked this question...........
well to begin with call by value.
it is used when u don't want to
change the contents of a variable permanently
well to understand this u 1st have 2 understand the
concept of pointers or memory locations..........
in call by value u ar passing the copy of variable
changing it in the called fuction doesn't effect the memory loaction of
the variable.........but in case of the call by refrence u r passing the
address of the variable......so any change wud b a permanent change
as u practice more u wud urself understand when 2 use which 1.

frank
Reply With Quote  
Join Date: Apr 2005
Posts: 3
Reputation: Potsuki is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Potsuki Potsuki is offline Offline
Newbie Poster

Re: Passing Variables/Parameters - By Ref/Value?

  #3  
May 28th, 2005
Hi Frank

Thank you for your repsonse. This has helped me to understand this more.

Thank you

Potsuki
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Computer Science and Software Design Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Computer Science and Software Design Forum

All times are GMT -4. The time now is 8:46 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC