C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers


10,705 users

passing by value, passing by pointer and passing by reference

0 votes
please explain what is
"passing by value", "passing by pointer" and "passing by reference"
asked May 27, 2011 by sagar Expert (12,340 points)

1 Answer

0 votes
Best answer
Pass By value & Pass By Pointer are the terms came from C.

Whenever a function calls arguments they are passed in two ways...
call by value and call by reference

call by value
Copy of actual argument is passed thus any changes made to the formal argument [i.e. copy of actual argument] is not reflected in actual argument.

call by reference
Here address of argument is passed rather than the value. the compiler itself finds what value is stored on the address. any changes made to the formal argument is reflected in actual argument also b coz the value is modified at the address.

We prefer call by reference over call by value.
because  with later their are more chances of making mistake.

i hope it clears your doubs.
answered May 27, 2011 by albertina Geek (15,670 points)

Related questions

0 votes
1 answer 428 views
0 votes
1 answer 1,032 views
1,032 views asked May 27, 2011 by carlton Sr Member (3,990 points)
+1 vote
2 answers 4,230 views
4,230 views asked Jun 10, 2010 by anonymous
+1 vote
1 answer 2,310 views
0 votes
1 answer 96 views
96 views asked Jun 9, 2010 by anonymous