I know the memory layout of a C program is divided into text, heap, stack, data and bss segments. I think (not sure) that this memory layout alone is the reason behind maintaining the scope and lifetime of variables of different storage classes.
For example, auto variables are stored in the stack. Each time a function call happens, a new stack frame is created which limits the access to called function's auto variables. But they are still inside their associated frame and get into action as soon as the called function returns control.
Thus, we can justify the scope and lifetime of auto variables. But, I want to know which data structures are used in the other segments (viz. data, bss and heap) to maintain such scoping. Or is it something else other than the memory layout that controls the scope and lifetime?