Q:

Which is the memory space for static variable declared inside a function?

We know that when a function is called a block of memory is pushed into the stack and when the function finishes its job the block of memory which was pushed earlier is now popped out.
Is it correct in all the circumstances. Even if the function contains declaration of static variables? If yes then how do the static variables retain their values? Are they assigned memory space in heap and not stack ?

A:

Static local variables don't live on the stack, they live in the same memory as a global variable.  .bss is memory where global variables that are uninitialized will reside.  .data could hold variables declared with an initial value.

