explain memory layout of a C program

Answers were Sorted based on User's Feedback



explain memory layout of a C program..

Answer / ravindra garg

(Higher Memory Address)

STACK -->Func arguments and return val(locals)
'
'
|
^
'
HEAP --> Dynamic Data

BSS --> Uninitialized Data
(Global and static default to zero)

DATA SEGMENT --> Initilialised data
(Global and static with init vals)

CODE SEGMENT --> Instructions

[Lower Memory Address]

Is This Answer Correct ?    38 Yes 3 No

explain memory layout of a C program..

Answer / 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

More C Interview Questions

What is static and auto variables in c?

0 Answers  


Write a C program to perform some of the operation which can be performed using Single linked list

1 Answers   Qualcomm,


write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.

0 Answers  


How can I call a function, given its name as a string?

4 Answers   ABC Telecom,


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

0 Answers  






How to run c Program without using IDE of c. means if program made in notepad.then how to compile by command prompt.

1 Answers   HP, TCS,


What is a floating point in c?

0 Answers  


What compilation do?

7 Answers   Geometric Software, Infosys,


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

0 Answers  


what is c++ programming?

3 Answers   TCS,


Determine the result of performing two successive block transfers into the same area of a frame buffer using the binary arith operations

0 Answers  


What are the advantages of c preprocessor?

0 Answers  


Categories