reverse the order of elements on stack S using one additional stack and some additional nonarray variables
you can pop from one stack and push popped element into second stack. You can get reverse of a stack.
int p= P1.top();
Now stack P1
this is a nice explanation of doing that using recursion
we have to use only additional one stack
yes you can do that by using 1 additional stack ,
//P1 is the stack reverse you want.
//P2 is the reverse of a stack.
int p= P1.pop()
i want reverse of elements in the p1 itself.
and what about using non array variables while reversing the stack with one additional stack?
here non array variable is variable p
using recursion how?
it is explained there in the link i have given