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.
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) kst-u@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"
>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
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.
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
>
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/
>
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) kst-u@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"
>>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.
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.
>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.
> 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...
Comment