Sorry, I just saw this comment. It is to make sure changes to top persist outside of the push function, so that top always refers to the top of the stack if top > -1.
You could also make top static to achieve persistence, but then that would give push ownership of top and I want push to work for any stack.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sorry, I just saw this comment. It is to make sure changes to
toppersist outside of thepushfunction, so thattopalways refers to the top of the stack iftop > -1.You could also make
topstatic to achieve persistence, but then that would givepushownership oftopand I wantpushto work for any stack.