标签:全局 str 空间 语句 blank 重新定义 不能 sys main函数
每个名字都有自己的活动空间,同一个名字在不同的作用域可能指向不同的实体。
#include<iostream> using namespace std; int main() { int i = 10; for (int j = 0;j <= 10;j++) { } }
嵌套的作用域
内层作用域(inner scope)
。外部作用域(outer scope)
。#include<iostream> using namespace std; int a = 10; int main() { cout << a << endl; // (1)输出10 int a = 0; cout << a << endl; // (2)输出0 cout << ::a << endl; // (3)输出10 system("pause"); return 0; }
转自离群土拨鼠的博客,原文链接:https://www.jianshu.com/p/b768a90568b4
标签:全局 str 空间 语句 blank 重新定义 不能 sys main函数
原文地址:https://www.cnblogs.com/damaohai/p/11497214.html