Developer community
0 votes
298 views
please explain what is
"passing by value", "passing by pointer" and "passing by reference"
asked by Expert (12.3k points) 7 12 25 | 298 views

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

Related questions

0 votes
1 answer
asked by carlton Sr Member (4k points) 5 11 21 | 1k views
+1 vote
2 answers
+1 vote
1 answer
0 votes
1 answer
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


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

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users