前置知识(prerequisite)
- linkage and storage duration
- scope
这两个前置知识可以在 cppreference.com 学习
本地变量与全局变量(local variable and global variable)
File-scope identifiers have external linkage and static storage duration by default.
我们常说的中的 local variable 和 global variable
scope | storage duration | linkage | description | |
---|---|---|---|---|
Local Variable | function | automatic | none | Declaring a variable inside a function definition |
Global Variable | file | static | extern | A variable declaration at the top level in a file |
reference
[1]: GNU C Language Introduction and Reference Manual
[2]: Scope
[3]: Storage-class specifiers