C++ Primer says
Each local static variable is initialized before the first time execution passes through the object\'s definition. Local statics are
Their scope is different. A global-scoped static variable is accessible to any function in the file, while the function-scoped variable is accessible only within that function.