passing

Archived from the original Sajha.com — preserved as posted, replies can no longer be added here.
Start a New Discussion
Archived Post

passing method param by value passing method param by reference Care to enlighten?

cp21 · Nov 20, 2015 1:25 PM · 293 views

3 Replies

Passing by value: the actual values are copied to a procedure. Passing by reference: the location of the values in the memory or memory address of those values are passed to a procedure.

Pharsi · Nov 20, 2015 2:06 PM

To understand the difference you need to understand how information is saved in the computers. Information is saved in computer in Register as small little buckets called Memory addresses. Each address holds either piece of information bits or location of other memory addresses. When you pass by value , the actual information bit is copied from one address to another address. When you pass by reference, actual information is not copied rather it holds the address of another memory address to retrieve necessary bits. Hope that answers your confusion.

hamrochautari · Nov 20, 2015 2:56 PM

Why don't these books simplify it the way you guys have explained. Thanks for this. Last edited: 20-Nov-15 03:57 PM

cp21 · Nov 20, 2015 3:39 PM

This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.

Start a New Discussion