Call-by-Reference

  • Thread starter coolguyaroundyou
  • Start date
C

coolguyaroundyou

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

I think it doesn't. Am I right?
 
C

coolguyaroundyou

Technically speaking, does C have Call-By-Reference for a function??
I think it doesn't. Am I right?
 
E

Eric Sosman

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.
 
K

Keith Thompson

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.
 
M

Michael

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++
 
D

Dik T. Winter

>
> 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.
 
K

Keith Thompson

Dik T. Winter said:
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.
 
C

CBFalconer

Nick said:
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)
 
J

jameskuyper

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.
 
C

CBFalconer

jameskuyper said:
Eric Sosman wrote:
...

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. :)
 
J

Joachim Schmitz

jameskuyper said:
Eric Sosman wrote:
...

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top