If we don’t declare the iterative variable for preorder as static , it will backtrack.
How.?
If we don't declare the iterative variable for preorder as static
if you don’t declare variable as static then it will create every time
Static variables when used inside function are initialized only once, and then they hold there value even through function calls. These static variables are stored on static storage area , not in stack