ProAnswers.org

Passing by value, passing by pointer and passing by reference

please explain what is
“passing by value”, “passing by pointer” and “passing by reference”

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.