+ 1

Where does the static local variable of the function gets memory, in stack or in heap?

The static local variable of any function does not loose its memory after the execution of function. After the execution of any function all its local variable losses its memory and they get popped out from the stack whereas the variables with static keywords don't looses its memory till the end of the program. So my question exactly is don't static local variables get memory allocation in stack? Or if it gets then how does it work? Why don't it get popped out after the execution of function.

1st Aug 2020, 5:51 AM
Riya Kumari
Riya Kumari - avatar
2 Respostas
1st Aug 2020, 6:08 AM
Ipang
0
Thanks
1st Aug 2020, 8:03 AM
Riya Kumari
Riya Kumari - avatar