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

3,749 questions

4,049 answers

114 comments

10,705 users

passing by value, passing by pointer and passing by reference

0 votes
291 views
please explain what is
"passing by value", "passing by pointer" and "passing by reference"
asked 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 by albertina Geek (15,670 points)

Related questions

0 votes
1 answer 433 views
0 votes
1 answer 1,039 views
1,039 views asked by carlton Sr Member (3,990 points)
+1 vote
2 answers 4,235 views
+1 vote
1 answer 2,315 views
0 votes
1 answer 97 views
...