activation-record

Where are global variables located in the activation record for C?

瘦欲@ 提交于 2020-02-06 08:05:49
问题 In C, each function has an activation record which is allocated on a stack frame. Local variables are allocated in their own function's activation record. So, what is the case with global variables? Where are they allocated? For example #include <stdio.h> int a; void v() {a= 2; int b; b++; } main() { int f; printf("\n%d",a); v(); } -----Activation record---- ------------------- ------------------- activation record for main ------------------- int f ------------------- -------------------

Where are global variables located in the activation record for C?

空扰寡人 提交于 2020-02-06 08:03:28
问题 In C, each function has an activation record which is allocated on a stack frame. Local variables are allocated in their own function's activation record. So, what is the case with global variables? Where are they allocated? For example #include <stdio.h> int a; void v() {a= 2; int b; b++; } main() { int f; printf("\n%d",a); v(); } -----Activation record---- ------------------- ------------------- activation record for main ------------------- int f ------------------- -------------------