0 votes 0 votes void abc() { auto int a; static int s; a=s++; printf("%d%d",a,s); if(a<=2) abc(); printf("%d%d",a,s); } void main() { abc(); abc(); } how many times printf will execute?? saipriyab asked Nov 24, 2017 saipriyab 695 views answer comment Share Follow See all 10 Comments See all 10 10 Comments reply Show 7 previous comments SHUBHAM SHASTRI commented Nov 24, 2017 reply Follow Share oh! ..i got it... 0 votes 0 votes hs_yadav commented Nov 24, 2017 reply Follow Share @ saipriyab after the completion of first abc(); s=4 after the second call oof abc(); a=s++(a=4) s=5) and print(4,5) then a<=2 print(4,5)..... 1 votes 1 votes saipriyab commented Nov 24, 2017 reply Follow Share yes I got it 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes o/p 0,1 1,2 2,3 3,4 3,4 2,4 1,4 0,4 4,5 4,5 reason is static variable initialize only once . Nitesh Choudhary answered Nov 24, 2017 Nitesh Choudhary comment Share Follow See all 2 Comments See all 2 2 Comments reply abhishek tiwary commented Nov 25, 2017 reply Follow Share after 3,4 how the value of a get decremented?? 0 votes 0 votes abhishek tiwary commented Nov 25, 2017 reply Follow Share ok i got it 0 votes 0 votes Please log in or register to add a comment.