The stack

Hi, I'm new to these forums!
I need help understanding "The Stack"
I understand its like a series of cubbyholes where 1 in is the first out
[]
[]
[]
[]
[]
but I don't understand whats the advantage of using the stack in c++ or why it was decided to be used, I don't get why you even need to understand it to code, any tips or questions to better understand it?
The first computers and hence assembler language took great advantage in using stacks because it makes quick access to programming steps and to local variables. Not just in C++, but C, VB, any language comes down to using stacks: The primary reason is that hardware is much easier to construct if it uses a stack.

Stacks are useful data structures as well. To be the best debugger, you need to embrace stacks IMHO.

Good luck!

i understand its useful, but where exactly are you going to include your knowledge about "The Stack" in your coding?
Perhaps if you were writing a calculator program, you would use a stack. See this link for more info: http://en.wikipedia.org/wiki/Stack_(data_structure). And this link: http://msdn.microsoft.com/en-us/library/aa227588(v=vs.60).aspx
Last edited on
kooth,
thank you! the microsoft link gave me the answers i needed :)
That explains 'a stack', he is asking about knowing 'the stack'.

For general application level programming, you wouldn't really need to know much, but if you ever make a process that modifies another process, you would need to know it very well. It's usefull in debugging as well, because you will need to be able to understand it to be able to follow the flow of execution.
Topic archived. No new replies allowed.