explain memory layout of a C program
Answers were Sorted based on User's Feedback
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 |
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 |
What is static and auto variables in c?
Write a C program to perform some of the operation which can be performed using Single linked list
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.
How can I call a function, given its name as a string?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
How to run c Program without using IDE of c. means if program made in notepad.then how to compile by command prompt.
What is a floating point in c?
What compilation do?
7 Answers Geometric Software, Infosys,
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
what is c++ programming?
Determine the result of performing two successive block transfers into the same area of a frame buffer using the binary arith operations
What are the advantages of c preprocessor?