Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Memory Segments Queries (http://www.go4expert.com/forums/memory-segments-queries-t14988/)

kanaks_go4ex 6Nov2008 01:01

Memory Segments Queries
Analyzing the memory layout for my sample program in Linux Environment.



int test_g = 1; // Data or BSS ? Data section Right ?
int test_h; // Data or BSS ? BSS section Right ?

static int test_s = 1;
static int test_q;

int func1(bool a ,bool b)
short temp;
static int var_temp; // Stack or BSS ?
return 0;


int main(void)
int m_var = 0; // Will be assigned in Stack section Right ?
static int main_temp = 0 ; Which section Data or BSS ?
m_var = func(true,true);// Will be assigned in Stack section Right ?

return m_var;


help me for the queries added as comments in 'C' Program.

My Qs Is :

What are all the sections shared during ,when the function call func1 made from the main?

Generally every function call has its own stack.Other sections bss , data . text are shared between the multiple process or threads ?.
will the heap shared ?

Will the compiler assign the sections during the program compilation itself?

shabbir 6Nov2008 09:32

Re: Memory Segments Queries
Duplicate of Memory Segments Queries. Thread closed.

All times are GMT +5.5. The time now is 05:56.