473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1710
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_Keith) 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.invalidwrote:
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.invalidwrote:
>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.orgKeith Thompson <ks***@mib.orgwrites:
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.orgKeith Thompson
<ks***@mib.orgwrites:
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_Keith) 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
Nick Keighley wrote:
Eric Sosman <esos...@ieee-dot-org.invalidwrote:
>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, you are wrong. The normal reading is handled by "C function
arguments are passed by value". The off-beat reading is handled by
the fact that C does NOT have "Call-By-Reference".

A third possible reading is that you are asserting "C function
arguments are passed by wrong".

:-) (and you are wrong)

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 10 '08 #11
Nick Keighley wrote:
On 9 Nov, 18:53, Eric Sosman <esos...@ieee-dot-org.invalidwrote:
>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"?
If I remember right, I didn't mean "wrong" -- but I could be
wrong, right?

Two wrongs don't make a right, but three lefts do.

--
Er*********@sun.com
Nov 10 '08 #12
Eric Sosman wrote:
....
Two wrongs don't make a right, but three lefts do.
I miss street grids! Where I currently live, three left turns often
get me on a dead-end street, and usually get me lost - they are seldom
the equivalent of a right turn.
Nov 10 '08 #13
jameskuyper wrote:
Eric Sosman wrote:
...
>Two wrongs don't make a right, but three lefts do.

I miss street grids! Where I currently live, three left turns
often get me on a dead-end street, and usually get me lost -
they are seldom the equivalent of a right turn.
You are allowed to move out of Boston. :-)

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 11 '08 #14
jameskuyper wrote:
Eric Sosman wrote:
...
> Two wrongs don't make a right, but three lefts do.

I miss street grids! Where I currently live, three left turns often
get me on a dead-end street, and usually get me lost - they are seldom
the equivalent of a right turn.
where I live 3 rights re likely to make a left, but three lefts will, on
average, get you in trouble with the police twice...

Bye, Jojo
Nov 11 '08 #15
CBFalconer wrote:
jameskuyper wrote:
>Eric Sosman wrote:
...
>>Two wrongs don't make a right, but three lefts do.
I miss street grids! Where I currently live, three left turns
often get me on a dead-end street, and usually get me lost -
they are seldom the equivalent of a right turn.

You are allowed to move out of Boston. :-)
It's actually the Maryland suburbs of Washington, DC.
Nov 11 '08 #16

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

Similar topics

1
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...
23
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
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: ...
7
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
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...
5
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...
7
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...
3
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...
2
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...
11
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.