static全局变量不应该在头文件中声明对吗?
![](zzz/editor/img/code.gif)
/*other.cpp*/ #include"other.h" static int sum = 100;
![](zzz/editor/img/code.gif)
/*other.h*/ #ifndef _OTHER_H__ #define _OTHER_H__ static int sum; #endif
这种写法是错的对吗?那个sum不应该在other.h中声明对吧?
/*other.cpp*/ #include"other.h" static int sum = 100;
/*other.h*/ #ifndef _OTHER_H__ #define _OTHER_H__ static int sum; #endif