Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Call by Value and Call by Reference

This is a discussion on Call by Value and Call by Reference within the C and C++ forums, part of the Software Development category; Call by Value and Call by Reference In this tutorial you will learn about C Programming - What is difference between call by value and call by reference in function? ...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 07-06-2006
Moderator
 
Join Date: Oct 2005
Posts: 1,036
Blog Entries: 75
Thanks: 3
Thanked 168 Times in 136 Posts
Lokesh M has a spectacular aura aboutLokesh M has a spectacular aura about
Call by Value and Call by Reference

Call by Value and Call by Reference

In this tutorial you will learn about C Programming - What is difference between call by value and call by reference in function?

The arguments passed to function can be of two types namely
1. Values passed
2. Address passed

The first type refers to call by value and the second type refers to call by reference.


For instance consider program1


Read More...
Reply With Quote
The Following User Says Thank You to Lokesh M For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 07-12-2006
Contributing Member
 
Join Date: May 2006
Posts: 84
Thanks: 0
Thanked 11 Times in 7 Posts
timmy is on a distinguished road
Re: Call by Value and Call by Reference

It was useful information about passing arguments to functions. In call by value argument gets passed as variables and in call by reference address gets passed. Does it mean if we use call by reference the execution time would be faster for the function since we the address gets accessed directly. If not why is it so?
Reply With Quote
  #3 (permalink)  
Old 06-23-2009
Junior Member
 
Join Date: Jun 2009
Location: Coimbatore,
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mohshha is on a distinguished road
Re: Call by Value and Call by Reference

call by value:

fun(5);

call by reference

fun(&a);


definition call by value

int fun(int a)
{
int b;
b= a+ 2;
return(b);
}

call by reference

int fun(int *a)
{
b=(*a )+ (*a)
return b;
}
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 09:02 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved