Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference between call by value and call by reference

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
varun kumar

New User


Joined: 20 Oct 2005
Posts: 1

PostPosted: Thu Oct 20, 2005 1:20 pm    Post subject: Difference between call by value and call by reference
Reply with quote

what is the difference between call by value and call by reference.
Back to top
View user's profile Send private message

sairam

New User


Joined: 30 Aug 2005
Posts: 58
Location: Kolkata

PostPosted: Thu Oct 20, 2005 1:40 pm    Post subject:
Reply with quote

Hi Varun

Call by value means the values will be passed in the calling function.The called function uses this values.The original variable doesnot change.It's value remain unchanged.

Ex
main function {
.
int a,b;
.
Call fun(a,b)
.
.


}

fun(int c,int d)
{

c=c+1;d=d+1;

}

here the changes of value will not be reflected in the variable passed as
parameter in calling function in main.

In case of call by reference the address of variable is passed,so change in the called function will be reflected in called function.

Hi if any doubt please let me know,i explained it shortly
Back to top
View user's profile Send private message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Fri Oct 21, 2005 11:33 am    Post subject: Re: Difference between call by value and call by reference
Reply with quote

Hi Varun


This question has been answered so mny times.
Plz do search in the forum before ask questions.

Answer for ur question is

Parameters can be passed either by reference or conten(value).
If a paremeter is passed by reference both the called and calling program share the same storage space, so if any changes in the formal parameters (Called pgm parameters) will reflect in the actual paramers (calling pgm).

If a parameter is passed by content , calling and called do not share the same storage, so any changes in the called pgm will not reflect in the calling pgm . This is the difference.

Call by reference is default.

If you knw C language , thr is a concept called pointer which uses addressing. (means call by reference)

Corrections are welcome.


Karthi G.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us