I am not getting the correct output for reversing a stack.
reverseStack wrong output
Replace s1 by &s1 in line 5.
This solves it correctly. You just need to pass it by reference. The logic is correct.
1 Like
I am not getting the correct output for reversing a stack.
Replace s1 by &s1 in line 5.
This solves it correctly. You just need to pass it by reference. The logic is correct.