ownload the BYJU'S Exam Prep App for free GATE
DOWNLOAD NOW ×
Login
Type your
GATEsearch
2024 GATE Previous Year Question
BYJU'S GATE > GATE > Difference
Between > Difference Between Call by Value and
Call by Reference
Difference Between
Call by Value and Call
by Reference
In a programming language, one can invoke
functions in two ways: known as Cell by
Value and Call by Reference. The general
basis of differentiation in these two ways is
the type of values that passes through them
in the form of parameters.
Ultimate Guide to Kickstart your GATE
Exam Preparation
Download the e-book now
The parameters that pass to the functions
are known as actual parameters, and the
parameters that the functions receive are
known as formal parameters. Now before we
dig into the difference between call by value
and call by reference, let’s know a bit more
about these two.
Difference Between Call by Value and
Call by Reference PDF
Download Full PDF
What is Call by Value?
In this particular parameter passing method,
the values of the actual parameters copy
into the function’s formal parameters. It
stores both types of parameters in different
memory locations. Thus, if one makes any
changes inside the function- it does not
show on the caller’s actual parameters.
This method passes a copy of an actual
argument to the formal argument of any
called function. In the case of a Call by Value
method, any changes or alteration made to
the formal arguments in a called function
does not affect the overall values of an
actual argument. Thus, all the actual
arguments stay safe, and no accidental
modification occurs to them.
What is Call by Reference?
In this case, both the formal and actual
parameters refer to a similar location. It
means that if one makes any changes inside
the function, it gets reflected in the caller’s
actual parameters.
This method passes the address or location
of the actual arguments to the formal
arguments of any called function. It means
that by accessing the actual argument’s
addresses, one can easily alter them from
within the called function. Thus, in Call by
Reference, it is possible to make alterations
to the actual arguments. Thus, the code
needs to handle the arguments very
carefully. Or else, there might be unexpected
results and accidental errors.
Difference Between Call by
Value and Call by Reference
P Call By Value Call By Reference
a
r
a
m
et
er
C In this case, the In this case, the
o parameter’s parameter’s
n value passes for reference passes
v invoking the for the function
e function. In the invocation.
nt case of calling a Whenever calling
io function, we pass a function, rather
n the values of than passing the
of variables directly variables’ values,
N to a function. we pass its
a Thus, it has its address instead
m name as Call by (location of
in Value. variables) to the
g function. Thus, it
has its name as
Call by Reference.
Ef It copies the Both the passed
fe value of a parameter and
ct passed the argument
s parameter into refer to a similar
of the function’s location. Thus,
C argument. Thus, any changes
h any changes occurring in any
a that occur in any argument inside
n argument inside the function also
g the function have reflects in the
e no reflection on passed
s the passed parameter.
parameter.
T The method of The method of
y Call by Value Call by Reference
p passes a copy of passes the
e the variable. variable itself.
of Here, the values Here, it copies the
P of all the address of the
a variables copy actual variables
ss into their in the calling
in corresponding function into the
g dummy dummy variables
variables, also called functions.
called functions.
M The memory The memory
e location referred location referred
m to by the actual to by the actual
or arguments and arguments and
y passed passed
L parameters of a parameters of a
o function are function are the
c different. same. Meaning, it
at Meaning, it creates the
io creates the formal and actual
n formal and arguments in the
( actual very same
R arguments in memory location.
ef different memory
er locations.
re
d
)
L Languages like Only the JAVA
a C++, C#. PHP, language
n Visual Basic NET, supports the Call
g etc., provide by Reference
u support to the method in
a Call by Value programming.
g and use it as
e their default
S method.
u
p
p
or
te
d
V In the Call by In the Call by
al Value method, Reference
u there is no method, there is a
e modification in modification in
M the original the original value.
o value.
di
fi
c
at
io
n
In In the case of In the case of Call
te Call by Value, by Reference,
rn when we pass when we pass the
al the value of the parameter’s
I parameter location
m during the calling reference/addres
pl of the function, it s, it copies and
e copies them to assigns them to
m the function’s the function’s
e actual local local argument.
nt argument. Thus, both the
at actual argument
io and passed
n parameters refer
to one similar
location.
M The values of the Defining the
et variables in a pointer variables
h Call by Value in a Call by
o method pass Reference
d using a method is a
of straightforward prerequisite for
P method or a storing the
a Simple address of all the
ss technique. variables.
in
g
M Using this Using this
a method, any method, one can
ni changes directly use the
p occurring to the addresses to
ul dummy access the actual
at variables in any variables. Thus,
io called function any user can
n have no effect on easily alter or
of the actual manipulate the
V variable’s values variables’ values
ar in the calling through the
ia function. Thus, function calls.
bl you cannot alter
e or manipulate
s the actual
variables’ values
using the
function calls.
Keep learning and stay tuned to get the
latest updates on GATE Exam along
with GATE Eligibility Criteria, GATE 2023, GATE
Admit Card, GATE Syllabus for CSE
(Computer Science Engineering), GATE CSE
Notes, GATE CSE Question Paper, and more.
GATE Related Links
Swipe left
GATE Chemical Engineering
OLAP Ful
Syllabus
SSL Full Form XGA Full
Differenc
Difference Between GSM And
Combin
GPRS
Sequent
Difference Between Var And
CDI Full F
Let In JavaScript
Differenc
SPARC Full Form Engineer
Engineer
Join BYJU'S Learning Program
Name
Mobile Number
Submit
Explore Other Popular
Difference Between
Difference Between 32-Bit And
64-Bit Operating Systems
Difference Between Alpha And
Beta Testing
Difference Between
Authentication And
Authorization
Difference Between BFS And
DFS
Difference Between Binary Tree
And Binary Search Tree
Difference Between Black Box
Testing And White Box Testing
Difference Between C And C++
Difference Between Compiler
And Interpreter
Difference Between Core Java
And Advanced Java
Comments
Leave a Comment
Your Mobile number and Email id will not
be published. Required fields are marked
*
*
Mobile Number Send OTP
Type your message or doubt here...
Post My Comment
COURSES EXAMS
CBSE CAT Exam
ICSE CAT 2023
CAT GATE Exam
IAS GATE 2024
JEE IAS Exam
NEET UPSC Exam
Commerce UPSC Syllabus
JEE Main UPSC 2023
NCERT Bank Exam
JEE Advanced Government Exams
UPSC Prelims 2022 Question Education News
Paper
UPSC Prelims 2022 Answer CLASSES
Key
Kids Learning
IAS Coaching
Class 1st - 3rd
CBSE Sample Papers
Class 4th - 5th
CBSE Question Papers
Class 6th - 10th
Class 11th - 12th
BYJU'S Tuition
Centre
EXAM PREPARATION COMPANY
Free CAT Prep About Us
Free IAS Prep Contact Us
Maths Contact our
Financial Partners
Physics
Investors
Chemistry
Careers
Biology
BYJU'S in Media
JEE 2024
Social Initiative -
JEE Advanced 2023 Question
Education for All
Paper with Answers
BYJU'S APP
JEE Main Mock Test
FAQ
JEE Main 2023 Question
Papers with Answers Students Stories -
The Learning Tree
JEE Main 2022 Question
Papers with Answers Support
JEE Advanced 2022 Question Faces of BYJU'S –
Paper with Answers Life at BYJU'S
NEET 2023 Question Paper Blog
NEET 2023 Question Paper BYJU'S Give
Analysis
NEET 2022 Answer Key
BYJU'S Exam Prep
RESOURCES
Worksheets
BYJU'S Answer
DSSL
Home Tuition
All Products
Calculators
Formulas
FREE TEXTBOOK STATE BOARDS
SOLUTIONS
NCERT Solutions Maharashtra
NCERT Exemplar Gujarat
NCERT Solutions for Class 6 Tamil Nadu
NCERT Solutions for Class 7 Karnataka
NCERT Solutions for Class 8 Kerala
NCERT Solutions for Class 9 Andhra Pradesh
NCERT Solutions for Class 10 Telangana
NCERT Solutions for Class 11 Uttar Pradesh
NCERT Solutions for Class 11 Bihar
English
Rajasthan
NCERT Solutions for Class 12
Madhya Pradesh
English
West Bengal
NCERT Solutions for Class 12
RD Sharma Solutions
RD Sharma Class 10
Solutions
ICSE Selina Solutions
FOLLOW US
Hi there! Got any questions?
I can help you...
Disclaimer Privacy Policy Terms of Services
Sitemap
© 2023, BYJU'S. All rights reserved.