void foo(int x) {
if(x > 0) {
foo(--x);
printf("%d",x++);
foo(--x);
}
}
What will the output when the above function is called as foo(3) ?
Please provide recursion tree or stack diagram whichever you use to answer.
Edit :: How would the answer change if it was
void foo(int x) {
if(x > 0) {
foo(--x);
printf("%d",x);
foo(--x);
}
}