raju wrote:
Please provide context when replying. People might not have seen the
article you are replying to. For details on how to do this using Google
and other useful advice please see
http://cfaj.freeshell.org/google/
see every thing i.e is auto variables stored in stack when a fuction
called ,
Wrong for a number of reasons. The C standard does not mandate the
existence of a stack and even on real implementation with a stack auto
variables are often stored only in registers if the compiler can get
away with it because that is more efficient.
> if you made it as static int i=3;
this will be stored in initialized data segment.
Again, there may not be an initialised data segment. I've worked on real
systems without such a thing although they did (as the standard
mandates) initialise variables with static storage duration.
if you say static int j;
i,e uninitialized data segment and at runtime this will be assigned
to zero; samething with uninitiolized variables...
this will be stored in bss;
Again, not all systems have a bss section. However, you are correct that
the variables will be initialised to 0.
and initialized global variable get stored in datasegments
Again, there is no guarantee there is such a thing as a data segment.
Please don't assume that all the world is using the same system as you
since there are vast numbers of people using completely different
systems with different capabilities and terminology. Here we deal with
standard C not the specifics of your (or anyone else's) specific system.