If one block encloses the other, the declaration in the enclosed block hides that in the enclosing block until the end of the enclosed block is reached. In traditional C, the function arguments are in a separate block that encloses the function body block. Thus, traditional C would quietly hide the argument x with the local variable x , because they are in distinct blocks. ANSI C and traditional C differ in the assignment of block and file scope in a few instances. Only labels have function scope.
Function scope continues until the end of the current function.
This termination allows any dummy parameter names appearing in a function prototype to disappear at the end of the prototype. 4.1.1.4 File Scope Identifiers appearing outside of any block, function, or function prototype, have file scope. This scope continues to the end of the compilation unit. Unlike other scopes, multiple declarations of the same identifier with file scope can exist in a compilation unit, so long as the declarations are compatible. Whereas ANSI C assigns block scope to all declarations occurring inside a function, traditional C assigns file scope to such declarations if they have the storage class extern .