hi,
is it correct to state that a static variable is created only once and initialised only once and occupies some special global memory?
So lets say some sub routines declare and initialise a local static variable of the same name.
Is this possible - I mean will the variables only have local scope to the sub routines they are declared and initialised in ?
Will they exist seperately or how are they allocated?
Code:void my_func1 () { static int var = 0; // do whatever } void my_func2 () { static int var = 0; // do whatever } int main () { my_func1(); my_func2(); return 0; }




Reply With Quote