Originally Posted by
Elysia
I would make pop return the element that is removed and rename top to peek. I don't know why they did it like this in STL, but frankly, it's annoying and peek/pop is pretty much standard anyway.
And StainedBlue, as we have already tried to explain, the OP should not be using dynamic memory at this point. A stack does not need dynamic memory. A vector or a deque should suffice here. Let's not try to put out different solutions here. It will only serve to confuse.