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 diffrence between string and character array?
The difference between printf and fprintf is ?
Is this program statement valid? INT = 10.50;
Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage
Write a program in c to print * * * * * *******
What is uint8 in c?
What does emoji p mean?
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
What are variables c?
How can you read a directory in a C program?
Explain the use of #pragma exit?
can we store values and addresses in the same array? explain