+ 1
How it's output comes to 00?
int main() { static int x=3; if(--x){ main(); printf("%d ",x); } }
2 ответов
+ 5
You calling main function again and again it like a recursive type x=3 in if condition if(--x) here x will decrease means if(2) which is true after that u wrote main function so control will go again to main function then it will check condition if(--x) but x was 2 so if(--1) then maing again calling same process last value will be 0 and after that 0 0 0 will return .
+ 3
recursion tree:
If(2)
|
------------
| |
If(1) printf (x)
|
------------
| |
If(0) printf (x)
Finally x value becomes zero so it will print 00 as an output
(Inorder parsing)