Hi,
I'm having a problem with variable scope. I'm trying to modify a global integer within a function, and it doesn't seem to be working ... I've simplified the code to show what I mean:
For some reason the variable isn't getting modified in function 2, because the output in function 1 is the same. Any thoughts? Thanks for the input!!Code:static int variable; void function1(void) { cout << variable; } void function2(void) { variable++; } int main(void) { function2(); function1(); return(0); }