static variable memory storage

P

plmanikandan

Hi,

I have a doubt of storing static variables in memory.I think
static,global variables are stored in the same location.Static,Gloabal
variables are stored in HEAP .Can anybody explain me the storage area
of all type variable in memory


Rgds,
Mani
 
J

Jaspreet

Hi,

I have a doubt of storing static variables in memory.I think
static,global variables are stored in the same location.Static,Gloabal
variables are stored in HEAP .Can anybody explain me the storage area
of all type variable in memory


Rgds,
Mani

Does the language have any idea about heap or stack (As in storage
areas) ? Isn't it implementation dependant ? If yes, then I guess we
should not be worried about where those variables are stored.
 
R

Rolf Magnus

Hi,

I have a doubt of storing static variables in memory.I think
static,global variables are stored in the same location.Static,Gloabal
variables are stored in HEAP .Can anybody explain me the storage area
of all type variable in memory

C++ knows three types of memory storage types: static, dynamic and
automatic.
static memory is used for variables in namespace scope and static local
variables. dynamic memory is used by operator new and by *alloc. automatic
memory is used for non-static local variables.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top