Hi,
I have gone through a few posts on this topic in the forum and seem to get more confused.
I write a simple function in C which has local/automatic variables say a,b,c
Now from what i could gather from the forum posts is that the sections (data,code,stac k,heap etc) are not a part of the C standard.
So, suppose i decide to place my function in the bss segment.
Now during execution there will be a stack frame associated with this function which will be created when the function is called and destroyed when the function exits.
The stack frame will contain the local variables for the function? If so then is the variable present in the stack frame a copy from whichever section the function is placed in? It cant be a pointer to that section as this would modify the value over there right?
I am just starting to get into the internals of C and hence there might be mistakes in what i wrote.
Also, if anyone could point me to a good resource for clearing such doubts it would be really really helpful
I have gone through a few posts on this topic in the forum and seem to get more confused.
I write a simple function in C which has local/automatic variables say a,b,c
Now from what i could gather from the forum posts is that the sections (data,code,stac k,heap etc) are not a part of the C standard.
So, suppose i decide to place my function in the bss segment.
Now during execution there will be a stack frame associated with this function which will be created when the function is called and destroyed when the function exits.
The stack frame will contain the local variables for the function? If so then is the variable present in the stack frame a copy from whichever section the function is placed in? It cant be a pointer to that section as this would modify the value over there right?
I am just starting to get into the internals of C and hence there might be mistakes in what i wrote.
Also, if anyone could point me to a good resource for clearing such doubts it would be really really helpful
Comment