2 ms·
I'm not very familiar with dynamic scoping, so maybe I've misunderstood it, but that doesn't appear to be true. What variable a name binds to is determined enti
by mikeash 13y ago
I'm not very familiar with dynamic scoping, so maybe I've misunderstood it, but that doesn't appear to be true. What variable a name binds to is determined entirely at runtime, which happens for globals too. You cannot end up accessing a variable in your caller unless they explicitly pass in a reference to it, and it's not possible to write a function which refers to a single global variable in the code, but which can refer to different variables at runtime depending on the caller.
- justinpombrio 13y agoYou are correct. C is lexically (a.k.a. statically) scoped, through and through.