470,833 Members | 1,952 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

call by reference

Hello all,
I have a question. Does the concept of call by reference exist in C
like it does in C++? And if so, can someone give me an example.

Thanks
Jami

Mar 1 '06 #1
3 3061

jamihuq wrote:
Hello all,
I have a question. Does the concept of call by reference exist in C
like it does in C++? And if so, can someone give me an example.


You use pointers. Caller has to know and provide the appropriate data.

Mar 1 '06 #2
jamihuq wrote:
Hello all,
I have a question. Does the concept of call by reference exist in C
like it does in C++? And if so, can someone give me an example.

Thanks
Jami


Hi,

It works the same way, i.e. you pass an `int' by value, but there are
no references in C. So you must pass a pointer to an int, in order to
have call by reference.

Bahadir

Mar 2 '06 #3
* jamihuq:

I have a question. Does the concept of call by reference exist in C
like it does in C++? And if so, can someone give me an example.


The concept exists independent of language.

The language support for the concept differs depending on the language.

Since C is mostly a subset of C++, the support present in C (namely,
pointers) is also present in C++, and in addition C++ has a dedicated
reference type.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Mar 2 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

35 posts views Thread by hasho | last post: by
8 posts views Thread by ThomasR | last post: by
13 posts views Thread by mitchellpal | last post: by
22 posts views Thread by Nehil | last post: by
7 posts views Thread by Saeed Amrollahi | last post: by
15 posts views Thread by coolguyaroundyou | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.