Yes, you can simulate pass-by-reference in C by passing the address of
an object.
For example, this C++ code:
void increment(int &arg)
{
arg ++;
}
/* ... */
int x = 42;
increment(x);
can be implemented in C like this:
void increment(int *arg)
{
(*arg) ++;
}
/* ... */
int x = 42;
increment(&x);
Note that you have to explicitly take the address of the object in the
call, and explicitly dereference the passed pointer value in the
function itself.
--
Keith Thompson (The_Other_Keith) (e-mail address removed) <
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"