Tag: It differentiates the data area static class initial stat other stack space
1, define local static variables, stored in the global data area of the static variable area. Initialization is automatically initialized to 0, and its scope is a local scope, and when the function or statement block defining it ends, its scope ends.
2, static when defining global variables, this global variable can only be accessed in this file, cannot be accessed in other files, even extern external declarations can not.
3, static defines a function, then this function can only be called in this file, cannot be called by other files.
(1) When you do not want to be released, you can use the static modifier. For example, an array of modifier functions stored in the stack space. You can use the static modifier if you do not want this array to be released at the end of a function call
(2) Take into account the data security (when the process wants to use the global variable should consider the use of static)
4, the definition of static data members, has the following characteristics:
(1) Memory allocation: In the program's Global data area assignment
(2) initialization and definition: Static data member definitions are allocated space, so they cannot be defined in a class declaration
5. Define static member functions.
A static member function is associated with a class and is not associated with the object of the class. Static member functions cannot access non-static data members.
The role of keyword static in C + +