【发布时间】:2012-12-11 05:28:45
【问题描述】:
全局声明的变量被称为具有程序范围
使用 static 关键字全局声明的变量被称为具有文件范围。
例如:
int x = 0; // **program scope**
static int y = 0; // **file scope**
static float z = 0.0; // **file scope**
int main()
{
int i; /* block scope */
/* .
.
.
*/
return 0;
}
这两者有什么区别?
【问题讨论】:
标签: c scope storage-class-specifier