I\'ve been using C++ for a bit now. I\'m just never sure how the memory management works, so here it goes:
I\'m first of all unsure how memory is unallocated in a fu
In C,C++ local variables have automatic storage class and are stored in Stack.
When function returns then stack gets unwound and locals are no more accessible, but they still persist in memory and that's the reason when u define a variable in function it may contain garbage value.
It is just stack pointer manipulation in stack and on memory for local is removed actually.