static modified local variables and global variables
1.static modification of local variables:
Changed the lifetime of the variable ( whole project )
but doesn't change the scope of the variable ( still local scope )
2.static modification of global variables
Changed the scope of the variable; ( cannot be referenced for external source files, ie: cannot be imported with extern )
Does not change the lifetime of the variable ( still the whole project )
The following code is used as an example
A screenshot of the external source file (with the variable g_val defined) is as follows
The result is as follows