What is stack and heap?

Answer Posted / kannan.s

When a program is loaded into memory, it is organized into
three areas of memory, called segments: the text segment,
stack segment, and heap segment. The text segment
(sometimes also called the code segment) is where the
compiled code of the program itself resides. This is the
machine language representation of the program steps to be
carried out, including all functions making up the program,
both user defined and system.

The remaining two areas of system memory is where storage
may be allocated by the compiler for data storage. The
stack is where memory is allocated for automatic variables
within functions. A stack is a Last In First Out (LIFO)
storage device where new storage is allocated and
deallocated at only one ``end'', called the Top of the
stack.

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can interface inherit class in c#?

485


What is using in c#?

465


Can int be null c#?

523


How do I type a whitespace character?

526


What is difference between a function and a method?

491






What are the types of serialization?

509


Where are value types stored in c#?

515


Explain about Error handling and how this is done

531


What is a dictionary in c#?

490


How many bytes is a long c#?

459


Can we inherit private members of class in c#?

575


If c# destructors are so different to c++ destructors, why did ms use the same syntax?

494


Write a sample code to write the contents to text file in c#?

479


Can a method return multiple values in c#?

447


can you allow a class to be inherited, but prevent the method from being over-ridden?

546