2 votes 2 votes 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); } Programming in C programming-in-c recursion + – Rustam Ali asked Sep 2, 2016 • edited Sep 2, 2016 by dd Rustam Ali 928 views answer comment Share Follow See 1 comment See all 1 1 comment reply srestha commented Sep 2, 2016 reply Follow Share 1213121 2 votes 2 votes Please log in or register to add a comment.
4 votes 4 votes execute the tree from DFS manner you will get the output 1213121 Hira Thakur answered Sep 2, 2016 Hira Thakur comment Share Follow See all 2 Comments See all 2 2 Comments reply Daggerhunt commented Dec 22, 2016 reply Follow Share Why isn't the right sub tree getting executed first? What I mean is shouldn't the solution be 1211213 ? PLease explain a bit more. 0 votes 0 votes Shweta Nair commented Aug 24, 2017 reply Follow Share The traversal must always be from left to right. So it will execute the left subtree first - printing : 121 then the root : printing : 3 and then the right subtree, printing : 121 0 votes 0 votes Please log in or register to add a comment.