#include<stdio.h>
int fun(int i)
{
if ( i%2 ) return (i++);
else return fun(fun( i - 1 ));
}
int main()
{
printf(" %d ", fun(200));
return 0;
}
Correct me iwhere i am going wrong somewhere in my interpretation of the code.
first in main() inside from printf sends a call to fun function
then inside if(200%2) becomes false so else is returned
in which return says fun(fun(199))
and then again inside if(199%2) this becomes true so it will return 200
so fun(fun(200)) the nested function valuse is 200 so return is fun(200) it will run and if will become false and else will run which says return fun(fun(199))
so this an infinite loop