Hi suppose i have a following program.
void f ()
{
int a;
{
int a;
}
}
int main ()
{
return 0;
}
Now my question is, where the two variables
int a, from where memory is given to them.
second i would like to see the stack view for the same.
how can i see it?
Strinctly speaking, no any memory allocation for a vars in the snippet above: no any reference to f() in the program and a (clever) linker may ignore f() code at all.
Suppose you have:
Code:
int main()
{
f();
return 0;
}
1. int cell allocated in the stack for the 1st a var.
2. new int cell allocated in the stack for 2nd a var.
3. 2nd var cell (logically) deallocated.
4. All f() stack frame deallocated.
In practice your compiler may allocate for f() stack frame with two slots for both examples of a vars.
How can you see the stack view: it's your debugger isssue, not the C language topics...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.