View Single Post
Old Oct 4th, 2005, 10:12 AM   #2
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
I'm not sure what you're talking about, but here's an example where main passes a value to some function and then get the result back.
public static void main(string[] args)
{ 
    int TheValue = 5;                          //originally, TheValue=5
    TheValue = increase_it(TheValue);   //now TheValue=10
}

public int  increase_it(int AnyValue)
{
    AnyValue = AnyValue + 5;  //increment the received value by 5
    return AnyValue;              //return the new value
}
This is only one way to do it, passing by reference is another.
OpenLoop is offline   Reply With Quote