Crap.. Do you know of any way to accomplish this?
I thought this would work:
But then it will still return a '-1' in the last spot?
if(current == 0)
It's a pretty simple solution. Think about what you're trying to do. The pop() method should remove the last item from the stack and return it while remembering that the next item below it is now the last item.
Your code removes the last item from the stack, updates current to refer to the new last location, then returns the item at that new location. All you've got to do is figure out how to return the item at the original "current" location instead of what it becomes after the delete and decrement.
Or you can look at your other thread, although 7stud's version is even a little more complicated than it needs to be.