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

3.8k questions

4k answers


10.7k users

0 votes
please explain what is
"passing by value", "passing by pointer" and "passing by reference"
asked Expert 12.3k points 7 12 24

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 Geek 15.7k points 5 9 21

Related questions

0 votes
1 answer 438 views
0 votes
1 answer 1K views
What is the return value from printf() function?
asked carlton Sr Member 4k points 5 11 21
1 vote
2 answers 4.2K views
1 vote
1 answer 2.3K views
0 votes
1 answer 97 views