C Programming Reference
 
C Programming Reference >> C  Programming Reference Question Bank >>

19/07/07 - 398 Views - No Ratings Yet

Level - Advance
      

Question -


Output of the following code will be?
#include <stdio.h>

void e(int ); int main( ) { int a; a=3; e(a); return 0; } void e(int n) { if(n>0) { e(--n); printf("%d" , n); e(--n); } }
Answer -
 0120
Explanation -

This is the most difficult breed of output questions, recursion outputs. To find an ouput in recursion questions of c you need to trace every step in detail as following figure does in this question.

This figure adequately explain the reason of output of c source code in this question.

Reader Comments -

Author Comments
Add Comments 


Name :    
Reply :   


Rating :

Code :
Code

 

 
© 2006 cencyclopedia.com