where do the automatic variables go ?



In the following code:

int i = 5; ---> it goes to .data segment
int j; ---> it goes to bss segment


int main()
{
int c;
int i = 5; ---> stack
int j[5] = new int[5]; ----> heap
c = i*2; ----> goes to .text segment



}


My question is : When the object file is created there are text, data
and bss segments etc...but there is notthing like stack and heap
segment, what happens to these automatic variables ?

I hope I am making sense.....


Siddharth
.



Relevant Pages

  • where do the automatic variables go ?
    ... int main ... When the object file is created there are text, ... and bss segments etc...but there is notthing like stack and heap ... what happens to these automatic variables? ...
    (comp.os.vxworks)
  • Re: where do the automatic variables go ?
    ... int main ... and bss segments etc...but there is notthing like stack and heap ... The stack and heap areas are not needed in the executable. ...
    (comp.lang.c)
  • where do the automatic variables go ?
    ... int main ... When the object file is created there are text, ... and bss segments etc...but there is notthing like stack and heap ... segment, what happens to these automatic variables? ...
    (comp.os.linux.misc)
  • Re: skip compilation of unused functions
    ... are some functions of the dietlibc I'll never need in the final program. ... int reached ... gcc can't split object files. ... referenced from another object file. ...
    (comp.os.linux.development.apps)
  • Re: Thou shalt have no other gods before the ANSI C standard
    ... > compiler on Unix where my statement was wrong, ... global variables with a static initializer are put ... int y0000 = 1; ... When compiled into an object file, and then stripped (to remove the ...
    (sci.crypt)