Thursday 30 May 2019

What is difference between stack and heap? tccicomputercoaching.com

Stack and heap differ in the following ways:

I. Stack is Linear Data structure. Where Heap is non-linear Data structure.

II. Memory Allocation: Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM.


III. You would use stack only when you know for sure how much memory for your data you would need even before compile time. On the other hand, we can use heap without us having to know for sure the amount of memory we need.

IV. Variables: Variables allocated on the stack are stored directly to the memory and access to this memory is very fast, and it's allocation is dealt with when the program is compiled. When a function or a method calls another function which in turns calls another function etc., the execution of all those functions remains suspended until the very last function returns its value. Variables allocated on the heap have...

V. Stack follows LIFO structure, where queue follows FIFO structure.

There are various fundamental concepts, you can learn at TCCI Coaching Institute .

We teach C, C++, Java, Data Structure, DBMS , Python, .Net technologies etc.

To learn more in detail about Courses at TCCI.

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com/

No comments:

Post a Comment