+1 vote
76 views

Avoid the any syntax error ,if there is:What will be the output of the following code ?

#inlcude<stdio.h>
void myfun(int i)
{
if(i>0) {
myfun(i-1);
printf("%d",i);
myfun(i-1);
}
}
int main() {
myfun(3);
}


edited | 76 views
1213121

execute the tree from DFS manner you will get the output 1213121

Why isn't the right sub tree getting executed first? What I mean is shouldn't the solution be 1211213 ?