CIS 343 |
Scope |
Winter 2023 |
// The main program
var x;
function sub1() {
var x;
function sub2() {
. . .
}
}
function sub3() {
. . .
}
Assume that the execution of this program is in the following unit order:
x is the correct one for a reference to x?
a - d, is the variable allocated statically or dynamically?
Where is the variable stored? (Stack, heap, or global)
int a;
int main() {
static int b;
int c;
int *d;
d = malloc(sizeof(int)*3);
}
Updated Monday, 3 April 2023, 9:46 AM