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

What is the difference between functions getch() and getche()?

623


Can we increase size of array in c?

542


Explain the bubble sort algorithm.

646


What is an array? What the different types of arrays in c?

660


Write a Program to accept different goods with the number, price and date of purchase and display them

5450






What does 4d mean in c?

949


What are shell structures used for?

600


What are the differences between new and malloc in C?

610


Explain #pragma statements.

604


What is the -> in c?

585


Why n++ execute faster than n+1 ?

1851


#include { printf("Hello"); } how compile time affects when we add additional header file .

1424


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2000


praagnovation

1780


What is the use of clrscr?

597