+ 1
Stack implementation using array
Why n value decrement during push operation in this code https://code.sololearn.com/cFRuIrU3Xz9G/?ref=app
1 Respuesta
+ 4
n never decreasing. top is increasing..
n is size of array so n-1 is the last possible location to add element. So you can't add at next location, top++ results overflow so it print stack over"flow"...