How do I use variables from other functions in the MAIN function?

Mar 23, 2010 at 10:48pm
I have 3 functions and all of them have information the user inputs, but then I need to grab all that information and compute something in another function.

I heard I have to use return to do this?
But I am really unclear on how this command works, can somebody please give me an example? It would be really helpful.
Mar 23, 2010 at 10:50pm
1
2
3
 int function()
{//...blah blah blah...
return whatever;}


Then you can assign what ever the function returns to a variable in main like this
1
2
3
4
5
6
int main()
{ int fun;

fun = function();

//...} 
Mar 23, 2010 at 11:54pm
Ok thanks a lot.
Topic archived. No new replies allowed.