# user defined function help needed

53

dear sir,

How can i pass variable value between two functions, and whats wrong in the below code,
if i am in function  two(), how can i able to get/set value of a in function one() or get or set value of function three(),
please make change in such a way that i can able to get the value or set the value of function one() and function three ()
from function two()
int start()

//int  OnInit()

{

one();
two();
three();

return(0);

}

int one()

{

int a;
a=10;
return (a)   ;

}

int two()
{

int b;
b=20;
return(b);
}

int three()
{
int d;

d = one(a); // why i am not able to get a value ( a value is defined in one() )
return;
}
Moderator
9976

int start()
{
int aa=one();
int bb=two();
int dd=three();
Print(dd);

return(0);
}

//+------------------------------------------------------------------+
int one()
{
int a;
a=10;
return (a);
}
//+------------------------------------------------------------------+
int two()
{
int b;
b=20;
return(b);
}
//+------------------------------------------------------------------+
int three()
{
int d;
d=one();
return(d);
}
//+------------------------------------------------------------------+

I am not quite sure what you are trying to achieve, but the above modifications may help.

You could also pass variables to a function by reference

53

Thankyou  so much