static variable storage

Hi,

Where are the static variables actually stored in memory. Is it in .bss? In that case how is its storage different from global variables? From the ELF data is it possible to see the storage of different variables used in the program?

eg:

static int temp1;
int gtemp1;

main() {
static int temp2;
.
.
}

In this code segment, are both temp1 and temp2 stored in .bss?

Static variables are persistent for the duration of the program and are stored on the heap. The uninitialized ones are located in the bss section of the heap.

temp1 and temp2 will be located in the bss section of the heap as would be gtemp1 unless they were explicitly initialized.