In C, variables are always statically (or lexically) scoped i.e., binding of a variable can be determined by program text and is independent of the run-time function call stack.
For example, output for the below program is 0, i.e., the value returned by f() is not dependent on who is calling it. f() always returns the value of global variable x.
- Redeclaration of global variable in C
- Storage Classes in C
- Static Variables in C
- Data Types in C
- Variables and Keywords in C
- Interesting Facts about Macros and Preprocessors in C
- C Language Introduction
- Use of bool in C
- Complicated declarations in C
- Scope rules in C
- How Linkers Resolve Global Symbols Defined at Multiple Places?
- A nested loop puzzle
- G-Fact 8
- Static functions in C
- Understanding "extern" keyword in C
Improved By : InathiSirayi