memory segments in c

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • narendra jain
    New Member
    • Sep 2011
    • 1

    #1

    memory segments in c

    how can we define the memory segments in C.
    and how many segments are there available in C
    where local and global variable stored...?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Strictly there are no memory segments in C since C is platform independent and memory segments are dependent on the platform.

    However on the whole (i.e. in most cases) you have the following memory segments

    code or text - carrying the program code
    bss - carrying uninitialised or 0 initialised global variables
    data - carrying initialised global variables
    rodata - some platforms have a read only data segment and if they have it they can often put it into physically read only memory
    stack - carrying all local variables, function parameters and processor state normally in stack frames
    heap - the segment reserved to meet malloc allocations

    Note that, confusingly, in some contexts the data segment refers to everything that is not the text segment.

    Comment

    Working...