What would be the output of following code:
#include
void foo(int x)
{
if(x > 0)
{
foo(--x);
printf("%d\t", x++);
foo(--x);
}
}
int main()
{
int a = 3;
foo(a);
getchar();
return 0;
}
1
Compile time error.
2
Stack overflow.
3
0 1 0 2 0 1 0
4
0 1 0 2 0