////I can’t understand what is wrong with this. it shows x is out of scope but when i use brackets in if else statements then it works completely fine.
Stack Recursion
if you use if else and there is more than one line u must use brackets i think you are mistaking in it
your else was only reading one line int x so out of else x was not declared and you were using it @Ayush-Kokande-2816457821730452
But my stack still is not reversed
I pushed all elements in the stack and pushed all elements back into the same stack in backtracking what is wrong with it?
no in backtracking to the element u pop at last will be pushed first then so on …
so its same as it is @Ayush-Kokande-2816457821730452
u have to take the element from the top and then push it at the bottom using another recursive function @Ayush-Kokande-2816457821730452 is it clear?
Now i have understood. Thanks