473,786 Members | 2,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Call-by-Reference

Does C have Call-By-Reference for a function??

I think it doesn't. Am I right?
Nov 9 '08 #1
15 1735
Technically speaking, does C have Call-By-Reference for a function??
I think it doesn't. Am I right?
Nov 9 '08 #2
co************* *@gmail.com wrote:
Technically speaking, does C have Call-By-Reference for a function??
I think it doesn't. Am I right?
You are right: C function arguments are passed by value.

An argument value can, of course, be a pointer -- that is,
the argument value can refer to another object. But the
argument itself is always passed by value.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Nov 9 '08 #3
co************* *@gmail.com writes:
Does C have Call-By-Reference for a function??
Not directly, no; all parameters are passed by value. But of course
you can do the equivalent by passing pointers.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 9 '08 #4
co************* *@gmail.com wrote:
Does C have Call-By-Reference for a function??

I think it doesn't. Am I right?
There is no call-by reference in C but
int func(int&a);
is call-by-reference in c++
Nov 10 '08 #5
Michael said:
co************* *@gmail.com wrote:
>Does C have Call-By-Reference for a function??

I think it doesn't. Am I right?
There is no call-by reference in C but
int func(int&a);
is call-by-reference in c++
No, in C++ it's a declaration, not a call of any kind. And in C, it's just
a syntax error.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 10 '08 #6
On 9 Nov, 18:53, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
coolguyaround.. .@gmail.com wrote:
Technically speaking, does C have Call-By-Reference for a function??
I think it doesn't. Am I right?

* * *You are right: C function arguments are passed by value.
you mean "wrong"?
>
* * *An argument value can, of course, be a pointer -- that is,
the argument value can refer to another object. *But the
argument itself is always passed by value.

--
Nick Keighley
Nov 10 '08 #7
Nick Keighley said:
On 9 Nov, 18:53, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
>coolguyaround. ..@gmail.com wrote:
Technically speaking, does C have Call-By-Reference for a function??
I think it doesn't. Am I right?

You are right: C function arguments are passed by value.

you mean "wrong"?
No, he means "right", and he's right to mean that. The OP said he thinks
that C *doesn't* have call by reference. First, he asked whether it did,
and then he said he thinks not. He's right.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 10 '08 #8
In article <ln************ @nuthaus.mib.or gKeith Thompson <ks***@mib.orgw rites:
co************* *@gmail.com writes:
Does C have Call-By-Reference for a function??

Not directly, no; all parameters are passed by value. But of course
you can do the equivalent by passing pointers.
That is not the same as call by reference. With call by reference the
only place where you actually can *see* it is call by reference is in
the header of a function. Not in the body, nor in the actual call.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Nov 10 '08 #9
"Dik T. Winter" <Di********@cwi .nlwrites:
In article <ln************ @nuthaus.mib.or gKeith Thompson
<ks***@mib.orgw rites:
co************* *@gmail.com writes:
Does C have Call-By-Reference for a function??
>
Not directly, no; all parameters are passed by value. But of course
you can do the equivalent by passing pointers.

That is not the same as call by reference. With call by reference the
only place where you actually can *see* it is call by reference is in
the header of a function. Not in the body, nor in the actual call.
Yes, I know it's not the same thing, but it can be used to achieve
exactly the same effect.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 10 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3404
by: Marwan | last post by:
Hello I am using asynchronous delegates to make a call to a COM ActiveX object, but even though the call occurs on a separate thread, my UI is still blocking. If i put the thread to sleep in my delegate call, the application is well behaved (no UI freeze), but the call to the com object causes the UI to lock up Do I have to manage calls to an ActiveX object differently than using the BeginInvoke and a callback A sample of the code I...
23
5184
by: Fabian Müller | last post by:
Hi all, my question is as follows: If have a class X and a class Y derived from X. Constructor of X is X(param1, param2) . Constructor of Y is Y(param1, ..., param4) .
3
4060
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: oIE.Document.Forms("searchform").Item(<name>).Value = <myvalue> But I cannot control a dropdown with an onchange event. I can set the dropdown's value and selectedIndex, but then calling the onChange() or Click() does not do anything. It only seems to fire the onchange if I
7
6956
by: rahul8143 | last post by:
hello, what is difference between system call and library function call? Does library function call can have context switch to kernel mode? regards, rahul
4
4293
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage I know I need to call a function that will save data but I'm not sure exactly when to call this function. I've tried two ways and both seem to have 'gotcha's':
5
3780
by: Amaryllis | last post by:
I'm trying to call a CL which is located on our AS400 from a Windows application. I've tried to code it in different ways, but I seem to get the same error every time. Does anyone have any clue as to what this means? I am not trying to alter a table. This particular CL merely generates the next voucher number in a sequence. "SQL0204: HRCU030P in HRZNCUSOBJ type *N not found. Cause . . . . . : HRCU030P in HRZNCUSOBJ type *N was...
7
6807
by: archana | last post by:
Hi all, I am having application in which i am doing asynchronous call.I am using manualresetevent to wait for asynchronous call to complete. I want to stop asynchronous call after certain period of time. I want something like thread.abort for aborting aynchronous call. Can someone tell me way of aborting asynchronous call.
3
4785
by: cberthu | last post by:
Hi all, Is it possible to have two connects in the same rexx script to different DB's? I have to get data form on DB (with specifics selects and filter out some values with RExx) and save the results into another DB? I know from Wscripts and MS-Sql that you can build just two objects but I did not see something like that in REXX. Thanks in advance for your help
2
10583
by: savio XCIX | last post by:
I created the following stored procedure: ======= CREATE PROCEDURE TBLNAME.proc_test (IN p_custnum VARCHAR(8), IN p_zipcode CHAR(5), OUT r_valid CHAR(1), OUT r_bal DECIMAL(9,2)) LANGUAGE SQL BEGIN
11
3854
by: JCav | last post by:
I need to call a COM object from a remote machine using C#. I also need to pass on a different userID and password to the call. Has anyone done this? I've used Java to do this using JIntegra, but the application I'm using requires .NET. Any advice?
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.