+ 1
What does static variable means?
2 odpowiedzi
+ 3
normal variables lose their values when the function they are in is finished, but static variables get to keep their value as long as the program is running.
they have the same scope thou
+ 1
Static variable is a variable which retain its value between the function calls.
They are initialized only once and their scope is within the function where they are defined.
A static variable inside a function has a lifespan as long as program runs. It won't be allocated every time function is called and deallocated when function returns.
http://hckerspeaks.blogspot.in/2017/12/c-interview-question.html