Created: 2023-01-11 17:18
Status: #concept
Subject: Programming
Tags: C Local Variable Scope Global Scope
Block Scope
The "extent" of where identifiers are usable and can be accessed or altered.
Variables exist within the scope: on the line they were declared and until the end of the Compound Statement's }
closed curly brace.
When a Variable with a similar Identifier is declared inside its own separate Compound Statement, it hides the old identifier until the compound statement terminates, then it regains its old value.
References
- C Programming, A Modern Approach, 2nd Edition, Chapter 10.1