"Kay" <er*********@yahoo.com.hk> wrote in message
news:41**************@yahoo.com.hk...
I have got a question. There are three different functions that contain
a variable. How can I carry these variable to other function ?
You can't. But you could pass their values as arguments
to another function (provided their types are compatible
with the declared types of its parameters).
int other(int i1, int i2, int i3)
{
return i1 + i2 + i3;
}
int f1(void)
{
int v1 = 42;
return v1;
}
int f2(void)
{
int v2 = 99;
return v2;
}
int f3(void)
{
int v3 = 69;
return v3;
}
int main()
{
return (f1() - f3() + f2() - f1()) / other(f2(), f3() ,f1());
}
If you tell us what you're really trying to do, perhaps
I could come up with a more useful example.
-Mike