Re: Static Variables
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Tue, 20 Feb 2007 09:57:28 +0000
akhil.misra@xxxxxxxxx said:
where does a static variable inside a function get stored??
In random access memory, or "RAM" (or, if it's const, it might get put
into read-only memory, or "ROM").
where does it go in memory??
That's up to the implementation. It varies.
like Global goes in RAM,
Assuming you mean file scope objects with external linkage, yes, they're
stored in RAM (unless they're const, in which case they might go into
ROM).
Local variable goes on Stack...
Assuming you mean automatic objects, they're stored in RAM, unless
they're const, in which case they might go into ROM. They might be
incorporated into some kind of a stack structure, or they might not.
It's up to the implementation.
but how does static variable takes place in memory??
It goes into RAM (or, if it's const, it might go into ROM). The precise
details depend on the implementation.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.
- Follow-Ups:
- Re: Static Variables
- From: Jack Klein
- Re: Static Variables
- From: Flash Gordon
- Re: Static Variables
- References:
- Static Variables
- From: akhil.misra@xxxxxxxxx
- Static Variables
- Prev by Date: Re: c and assembler program, help me please!
- Next by Date: Re: recursive fuction
- Previous by thread: Re: Static Variables
- Next by thread: Re: Static Variables
- Index(es):
Relevant Pages
|