Difference Between Call By Value and Call By Reference?

Answers were Sorted based on User's Feedback



Difference Between Call By Value and Call By Reference?..

Answer / ravi s. sharma

In call by value, a copy of value known as(actual argument)
is passed to the function known as(formal argument). Both
values are stored at different locations and scope. The
changes made in a copy(formal argument) does not affect the
original value(actual argument).

In call by reference, a reference/address of variable known
as(actual argument) is passed to the function known
as(formal argument) which is stored in a
pointer/ref.variable. The changes made in a function
(through pointer/ref. variable) affect the original
value(actual argument).

Is This Answer Correct ?    15 Yes 5 No

Difference Between Call By Value and Call By Reference?..

Answer / shashi shekhar

For instance consider program1

main()
{
int x=50, y=70;
interchange(x,y);
printf(“x=%d y=%d”,x,y);
}

interchange(x1,y1)
int x1,y1;
{
int z1;
z1=x1;
x1=y1;
y1=z1;
printf(“x1=%d y1=%d”,x1,y1);
}

Here the value to function interchange is passed by value.

Consider program2

main()
{
int x=50, y=70;
interchange(&x,&y);
printf(“x=%d y=%d”,x,y);
}

interchange(x1,y1)
int *x1,*y1;
{
int z1;
z1=*x1;
*x1=*y1;
*y1=z1;
printf(“*x=%d *y=%d”,x1,y1);
}

Here the function is called by reference. In other words
address is passed by using symbol & and the value is
accessed by using symbol *.

The main difference between them can be seen by analyzing
the output of program1 and program2.

The output of program1 that is call by value is
x1=70 y1=50
x=50 y=70

But the output of program2 that is call by reference is

*x=70 *y=50
x=70 y=50

This is because in case of call by value the value is passed
to function named as interchange and there the value got
interchanged and got printed as

x1=70 y1=50

and again since no values are returned back and therefore
original values of x and y as in main function namely

x=50 y=70 got printed.

But in case of call by reference address of the variable got
passed and therefore what ever changes that happened in
function interchange got reflected in the address location
and therefore the got reflected in original function call in
main also without explicit return value. So value got
printed as *x=70 *y=50 and x=70 y=50

Is This Answer Correct ?    8 Yes 1 No

Difference Between Call By Value and Call By Reference?..

Answer / m.vairalkar

It is not difference
but good thing..Both tha
techniques r good ..if we want
changes then use call by refernce
otherwise use call by value

Is This Answer Correct ?    10 Yes 5 No

Difference Between Call By Value and Call By Reference?..

Answer / prateek g

The call by value system copies the actual parameters to
actual parameters and then uses them i.e. the function
creates its own copy of values, any change in
these values will not be reflected
in the original values.
The call by reference system refers the actual parameters
i.e. these doesn’t creates a copy of original parameters,
any change in these parameters will be reflected back in
original parameters.

Is This Answer Correct ?    7 Yes 2 No

Difference Between Call By Value and Call By Reference?..

Answer / varsha jarwal

In call by value:-
since new location is created, this method is slow.
In call by reference:-
since the existing memory location is used through its
address, this method is fast.

Is This Answer Correct ?    5 Yes 1 No

Difference Between Call By Value and Call By Reference?..

Answer / pasang tsering

call by value:-value of the actual argument passed to the
formal arguments.
call by reference:-address of the actual arguments passed
to the fomal arguments.

Is This Answer Correct ?    4 Yes 1 No

Difference Between Call By Value and Call By Reference?..

Answer / atul gupta

call by value: copies the value of argument into the formal
parameter.Any changes made in the parameter does not affect
the argument .

call by reference : copies the address of argument into the
formal parameter . The address will access the actual argument
used in the call . so any changes made in the parameter will effect the argument

Is This Answer Correct ?    4 Yes 2 No

Difference Between Call By Value and Call By Reference?..

Answer / vino

Mostly  call by value and call by reference is differ  from 
copy and modify process..
Copy:
Call by value:
It take difference memory locations  for variables.Duplicate copy of the original parameter is passed.
Call by reference:
It takes Same memoy locations for  variables.Actual copy of the original parameter is passed.
Modify:
Call by value:
No affect on original parameter after modifying the parameter in functions.
Call by reference:
original parameter can be affect afetr modifying the parameter in function..

Is This Answer Correct ?    2 Yes 0 No

Difference Between Call By Value and Call By Reference?..

Answer / meghanchal kumar dixit

call by value-
If we call a function in C  by passing values of variables as the parameters/arguments to the function then such type of function call is known as Call by value.

call by reference-A function by passing addresses of variables as the parameters to the function is known as Call by Reference.

Is This Answer Correct ?    2 Yes 0 No

Difference Between Call By Value and Call By Reference?..

Answer / aishwarya kulkarni

In call By Value it create different memory for local
variable and actual called Variable. so changes does not
affect to the actual variable.

Call By Reference:
In call By Reference Compiler create same memory location
for the local variable and actual called variable so changes
affect to the actual variable and modify the value of actual
called Variable.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SAP ABAP Interview Questions

What is an interface? In what scenario we use interface? What is the difference between abstract class and interface?

0 Answers   Infosys,


What is difference between dependent and independent data?

0 Answers  


What are the functional areas? User groups? And how does abap/4 query work in relation to these?

0 Answers  


What are aggregated objects

0 Answers  


What is the difference between table and template?

0 Answers  






how to use binary search in internal table?what is the use of indexes and secondary indexes?

3 Answers   Nokia, Sony,


Is it possible to bring select option in module pool screens?

0 Answers  


HOW TO DIFFERENT CALL TRANSACTION ON THE BASIS OF DOUBLE CLICKING ON DIFFERENT FIELD.

0 Answers   Cwell,


Why defining Logical systems?

1 Answers   Keane India Ltd,


what r the text elements in scripts?

2 Answers   Bristle Cone, Cap Gemini, HP, Satyam, Wipro,


What is an index? By default system will create the primary index or User can create,if user How? And also Secondary indexes by User or by defaultly system?

2 Answers   TCS,


what is the main difference between lsmw and bdc ? in which situation we will go for lsmw instead of bdc?

1 Answers   L&T,


Categories
  • SAP Basis Interview Questions SAP Basis (1262)
  • SAP ABAP Interview Questions SAP ABAP (3939)
  • SAPScript Interview Questions SAPScript (236)
  • SAP SD (Sales & Distribution) Interview Questions SAP SD (Sales & Distribution) (2716)
  • SAP MM (Material Management) Interview Questions SAP MM (Material Management) (911)
  • SAP QM (Quality Management) Interview Questions SAP QM (Quality Management) (99)
  • SAP PP (Production Planning) Interview Questions SAP PP (Production Planning) (523)
  • SAP PM (Plant Maintenance) Interview Questions SAP PM (Plant Maintenance) (252)
  • SAP PS (Project Systems) Interview Questions SAP PS (Project Systems) (138)
  • SAP FI-CO (Financial Accounting & Controlling) Interview Questions SAP FI-CO (Financial Accounting & Controlling) (2766)
  • SAP HR (Human Resource Management) Interview Questions SAP HR (Human Resource Management) (1180)
  • SAP CRM (Customer Relationship Management) Interview Questions SAP CRM (Customer Relationship Management) (432)
  • SAP SRM (Supplier Relationship Management) Interview Questions SAP SRM (Supplier Relationship Management) (132)
  • SAP APO (Advanced Planner Optimizer) Interview Questions SAP APO (Advanced Planner Optimizer) (92)
  • SAP BW (Business Warehouse) Interview Questions SAP BW (Business Warehouse) (896)
  • SAP Business Workflow Interview Questions SAP Business Workflow (72)
  • SAP Security Interview Questions SAP Security (597)
  • SAP Interfaces Interview Questions SAP Interfaces (74)
  • SAP Netweaver Interview Questions SAP Netweaver (282)
  • SAP ALE IDocs Interview Questions SAP ALE IDocs (163)
  • SAP Business One Interview Questions SAP Business One (110)
  • SAP BO BOBJ (Business Objects) Interview Questions SAP BO BOBJ (Business Objects) (388)
  • SAP CPS (Central Process Scheduling) Interview Questions SAP CPS (Central Process Scheduling) (14)
  • SAP GTS (Global Trade Services) Interview Questions SAP GTS (Global Trade Services) (21)
  • SAP Hybris Interview Questions SAP Hybris (132)
  • SAP HANA Interview Questions SAP HANA (700)
  • SAP PI (Process Integration) Interview Questions SAP PI (Process Integration) (113)
  • SAP PO (Process Orchestration) Interview Questions SAP PO (Process Orchestration) (25)
  • SAP BI (Business Intelligence) Interview Questions SAP BI (Business Intelligence) (174)
  • SAP BPC (Business Planning and Consolidation) Interview Questions SAP BPC (Business Planning and Consolidation) (38)
  • SAP BODS (Business Objects Data Services) Interview Questions SAP BODS (Business Objects Data Services) (49)
  • SAP BODI (Business Objects Data Integrator) Interview Questions SAP BODI (Business Objects Data Integrator) (26)
  • SAP Ariba Interview Questions SAP Ariba (9)
  • SAP Fiori Interview Questions SAP Fiori (45)
  • SAP EWM (Extended Warehouse Management) Interview Questions SAP EWM (Extended Warehouse Management) (58)
  • Sap R/3 Interview Questions Sap R/3 (150)
  • SAP FSCM Financial Supply Chain Management Interview Questions SAP FSCM Financial Supply Chain Management (101)
  • SAP WM (Warehouse Management) Interview Questions SAP WM (Warehouse Management) (31)
  • SAP GRC (Governance Risk and Compliance) Interview Questions SAP GRC (Governance Risk and Compliance) (64)
  • SAP MDM (Master Data Management) Interview Questions SAP MDM (Master Data Management) (0)
  • SAP MRS (Multi Resource Scheduling) Interview Questions SAP MRS (Multi Resource Scheduling) (0)
  • SAP ESS MSS (Employee Manager Self Service) Interview Questions SAP ESS MSS (Employee Manager Self Service) (13)
  • SAP CS (Customer Service) Interview Questions SAP CS (Customer Service) (0)
  • SAP TRM (Treasury and Risk Management) Interview Questions SAP TRM (Treasury and Risk Management) (0)
  • SAP Web Dynpro ABAP Interview Questions SAP Web Dynpro ABAP (198)
  • SAP IBP (Integrated Business Planning) Interview Questions SAP IBP (Integrated Business Planning) (0)
  • SAP OO-ABAP (Object Oriented ABAP) Interview Questions SAP OO-ABAP (Object Oriented ABAP) (70)
  • SAP S/4 HANA Finance (Simple Finance) Interview Questions SAP S/4 HANA Finance (Simple Finance) (143)
  • SAP FS-CD (Collections and Disbursements) Interview Questions SAP FS-CD (Collections and Disbursements) (0)
  • SAP PLM (Product Lifecycle Management) Interview Questions SAP PLM (Product Lifecycle Management) (0)
  • SAP SuccessFactors Interview Questions SAP SuccessFactors (33)
  • SAP Vistex Interview Questions SAP Vistex (0)
  • SAP ISR (IS Retail) Interview Questions SAP ISR (IS Retail) (28)
  • SAP IdM (Identity Management) Interview Questions SAP IdM (Identity Management) (0)
  • SAP IM (Investment Management) Interview Questions SAP IM (Investment Management) (0)
  • SAP UI5 Interview Questions SAP UI5 (59)
  • SAP SCM (Supply Chain Management) Interview Questions SAP SCM (Supply Chain Management) (51)
  • SAP XI (Exchange Infrastructure) Interview Questions SAP XI (Exchange Infrastructure) (49)
  • SAP Cloud Platform Interview Questions SAP Cloud Platform (34)
  • SAP Testing Interview Questions SAP Testing (89)
  • SAP SolMan (Solution Manager) Interview Questions SAP SolMan (Solution Manager) (63)
  • SAP MaxDB Interview Questions SAP MaxDB (116)
  • SAP GUI Interview Questions SAP GUI (15)
  • SAP AllOther Interview Questions SAP AllOther (329)