few options.
#1 pass the value
Code
void first(){
int magicVariable = 5;
second(magicVariable);
}
void second(int importantVariable){
// do something with importantVariable
}
#2 return value
Code
int first(){
int somethingImportant = 5;
// do stuff
return somethingImportant;
}
void second(){
int somethingImportant = first();
// do stuff
}
#3 declare it outside of the function
Code
int magicVariable = 5;
void first(){
// do something with magicVariable
}
void second(){
// do something with magicVariable
}
depends on how you wanna use it.
This post was edited by carteblanche on Apr 13 2014 04:42pm