【发布时间】:2013-12-08 13:29:36
【问题描述】:
您好,我想知道如何在块内引用变量“x”(主函数的):
#include <stdio.h>
int x=10; // Global variable x ---> let it be named x1.
int main()
{
int x=5; // main variable x with function scope ---> let it be named x2.
for(x=0;x<5;x++)
{
int x=2; // variable x with block scope ---> let it be named x3.
printf("%d\n",x); // refers to x3
printf("%d\n",::x); // refers to x1
// What is the syntax to refer to x2??? how should I try to access x2?
}
}
【问题讨论】: