全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Scope, shadowing?

又称: scope · shadowing

Definition 3.8 University Computer Science — Year 1 · 第 3 章 — Functions and the Call Stack

The scope of a name is the part of the program text where it refers to a given declaration. A name declared inside a block (between braces, or in the parentheses of a for) has block scope: from its declaration to the end of the block. A name declared outside every function has file scope: from its declaration to the end of the file. A declaration in an inner block shadows a declaration of the same name in an enclosing scope: inside the inner block, the name refers to the inner declaration.

在原文中阅读 →