void transfer(stack &s1 , stack &s2 , int n){
for(int i=0;i<n;i++){
s2.push(s1.top());
s1.top();
}
}
in this why has he written s1.top() after s2.push(s1.top())??
its working fine even if i remove s1.top()
Reverse Stack Using 1 Extra Stack
Yes that s1.top() is not required.
It think so it must be s1.pop() there. Check once
yes i also have this doubt but sir has not done it there if yo remove s1.top then also the code is working can u tell me why?