I’ve been reviewing C++ with the book Practical C++ Programming, and came across these things called Stacks. Defined in the book, it is defined as an algorithm for storing data.
From what I’ve seen in the book, it looks a lot like assembly…I also recall reading something about something that is 16 bit.
So my question: What are stacks used for, are they still useful or is it an old method of doing something that can be done more simply and efficiently with 32/64 bit computers? I’m just really confused about what purpose stacks serve.
Edit: Since my question is so vague, I’ll rephrase it… What is a stack, and when should it be used.
Depends on which stack you’re talking about.The first is a storage location in memory.
A stack is a last-in, first-out data structure which is still very useful regardless of 16/32/64 bit computers.
As others have said, the call stack (or ‘the stack’) is an example of a Stack in action.