static variable memory storage

Discussion in 'C++' started by plmanikandan@gmail.com, Feb 27, 2006.

  1. Guest

    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
    , Feb 27, 2006
    #1
    1. Advertising

  2. Jaspreet Guest

    wrote:
    > 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.
    Jaspreet, Feb 27, 2006
    #2
    1. Advertising

  3. Rolf Magnus Guest

    wrote:

    > 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.
    Rolf Magnus, Feb 27, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Hoffmann
    Replies:
    3
    Views:
    2,812
    Christian Jan├čen
    Aug 8, 2003
  2. Peter van Merkerk

    static variable and stack storage

    Peter van Merkerk, Aug 25, 2003, in forum: C++
    Replies:
    1
    Views:
    4,995
    Eric Liu
    Aug 26, 2003
  3. Pavan
    Replies:
    3
    Views:
    411
    Malcolm
    May 28, 2005
  4. sarathy
    Replies:
    2
    Views:
    650
    sarathy
    Jul 17, 2006
  5. arnuld
    Replies:
    2
    Views:
    353
    Phil Carmody
    Aug 8, 2009
Loading...

Share This Page