File scope
File scope is the C scope of an identifier declared outside any function or block and extending to the end of the source file.
Modern C, Third Edition
File scope is the scope of an identifier declared outside a function or block, extending through the relevant source file.
- How it is used
- Classifies identifiers declared outside function and block delimiters, establishing the outermost level of nested scopes.
- How deep it goes
- Defines file scope and contrasts it with nested block scope, stopping short of detailed linkage or lifetime rules.
- Examples
- Uses declarations of main, argc, argv, an array, and a size_t object as file-scope examples.
- What you can do after
- Evaluate whether a declaration belongs to file scope by checking whether it lies outside parentheses and braces.
Modern C
File scope is the C scope of an identifier declared outside any function or block and extending to the end of the source file.
- How it is used
- Explains how C determines an identifier's visibility when its declaration appears outside any function or block.
- How deep it goes
- Defines file scope and contrasts it with block scope through declaration locations and visibility ranges.
- Examples
- Uses main and other declarations written outside function or block boundaries to illustrate file-scope visibility.
- What you can do after
- Evaluate/understand whether an identifier remains visible through the end of a C source file.
Related concepts
- scopekind of · Scope is the region of a program in which names are visible and can be resolved according to the language’s lookup rules.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

