Quiz Entry - updated: 2026.07.14
What are the three types of linker symbols?
Global (defined in this module, usable by others), external (used here but defined elsewhere, via extern), and local (static, file-private).
* A module exports globals, imports externals, and hides locals — the three ways a name relates to the rest of the program. *
| Symbol Type | Definition | Example |
|---|---|---|
| Global | Defined by module m, can be referenced by other modules | Non-static functions, non-static global variables |
| External | Referenced by module m, but defined in another module | Symbols declared with extern |
| Local | Defined and referenced only within module m | static functions and variables |
Important distinction:
- Local linker symbols ≠ local program variables
- Local variables on the stack are NOT in the symbol table
staticvariables ARE in the symbol table (but only visible within their module)
Example:
// main.c
// Global symbol
int buf[2] = {1, 2};
// External symbol
extern int foo();
// swap.c
// Local symbol (file-private)
static int *bufp1;
// Global symbol
int *bufp0 = &buf[0];
Go deeper:
Symbol table (Wikipedia) — how names, bindings and sections are recorded for the linker.
nm(1) man page — read a module's globals (uppercase), locals (lowercase) and undefined refs (
U).