Monday, 9 September 2013

access variables from other function c++

access variables from other function c++

I must access variables declared inside other function.
Assume f1()
void f1()
{
double a;
int b;
//some operations
}
and f2()
void f2()
{
//some operations
//access a and b from f1()
}
Is it possilbe in c++? How can that be done?
Passing reference to function as shown here is not suitable answer for my
case because this corrupts the order of calling functions. Declaring
global variables also denied.

No comments:

Post a Comment