<分区>
可以使用::运算符在函数内访问全局范围变量。由于全局作用域没有名称,因此::的左侧可能为空。我将如何访问在函数范围内定义的变量,该变量稍后会在函数本身的 block 中被覆盖。在下面的代码中,我将如何访问初始化为 1 的变量?
extern int reused = 0;
int main()
{
int reused = 1;
{
int reused = 2;
cout << reused << endl; // how to get the reused inited to 1 here?
}
}