What is the purpose of a stack? Why do we need it?

So I am learning MSIL right now to learn to debug my C# .NET applications.

I’ve always wondered: what is the purpose of the stack?

Just to put my question in context:
Why is there a transfer from memory to stack or “loading?”
On the other hand, why is there a transfer from stack to memory or “storing”?
Why not just have them all placed in the memory?

  • Is it because it’s faster?
  • Is it because it’s RAM based?
  • For efficiency?

I’m trying to grasp this to help me understand CIL codes much more deeply.

7 Answers
7

Leave a Comment