Filter by Tags




1 0
This Question is asked to:
What is the difference between Call by Value and Call by Reference?
Manish Rawat
Posted on : Mon, Feb 06, 2017
Views : 249

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (1)


The call by value scheme is an asset, however, not a liability. It usually leads to more compact programs with fewer extraneous variables, because parameters can be treated as conveniently initialized local variables in the called routine. Yet, there are some cases where we need call by reference:

  1. The called function communicates to the calling function only through return statement and return statement can only send only one value back to the calling function. If there are more than one value we want to alter, call by reference is required
  2. If the size of data is large , copying actual arguments to formal arguments could be a time consuming operation and occupies more memory.
  3. The call by value does not address above cases, hence we need call by reference. To achieve call by reference functionality in C language the calling function provides the address of the variable to be set (technically a pointer to the variable), and the called function declares the parameter to be a pointer and access the variable indirectly through it. Since the address of the argument is passed to the function, code within the called function can change the value of the actual arguments.

    While studying call by value and call by reference in C it is important to note that the story is different for arrays. When the name of an array is used as an argument, the value passed to the function is the location or address of the beginning of the array --there is no copying of array elements. By subscripting this value, the function can access and alter any element of the actual array.

Sanampreet Aulakh
Mon, Feb 06, 2017

Edit Answer

This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links



Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..


Login to Open ESchool OR Create your account    Login   SignUp