explain memory layout of a C program

Answer Posted / pankaj saraf

Memory Layout consists following segments where data/text
are managed:
1) Text Segment : Consists serial of instruction.
2) Data Segment : Consists, Data default or defined class
specifier
i) Stack Segment : Area where the current function data
is managed.
ii) Heap Segment : Area where dynamically allocated data
stored.
3) BSS Segment: For uninitialized data.

Data segment is actually contains the static data which is
decided on the compile time. Rest of Area is used by Stack
and Heap which is actually modified run time. Stack grows
from higher address to lower Address. Heap grow just
opposite to the stack.

Anything else you guys are invited to add. :)

Is This Answer Correct ?    36 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a pointer be static?

634


Explain how do you search data in a data file using random access method?

705


What are called c variables?

587


What are the advantages of external class?

600


What is the purpose of 'register' keyword?

704






How do I read the arrow keys? What about function keys?

624


How does selection sort work in c?

635


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3064


What is pointers in c?

672


What is function what are the types of function?

572


How many types of functions are there in c?

591


Write a program of prime number using recursion.

630


Explain do array subscripts always start with zero?

771


What is cohesion and coupling in c?

599


What are the types of type specifiers?

629