在函数内定义一个与函数可能会用到的全局变量同名的局部变量总是不好的。
It is almost always a bad idea to define a local variable with the same name as a global variable that the function USES or might use.
如果给一个局部变量或函数的参数声明的名字与某个全局变量的名字相同,那么就有效地隐藏了这个全局变量。
If you declare a local variable or function parameter with the same name as a global variable, you effectively hide the global variable.
局部变量可以与全局变量具有相同的名称,但它们是完全不同且相互分离的。
A local variable can have the same name as a global variable, but it is entirely distinct and separate.
应用推荐