I have a hard time understanding the part of the code where the program is recalling on the recursion multiple times.
The output is 1233333
. If I change the recursion line to just fun (++count;
). the output is 123
, which I understand the logic, but when you start calling on the recursion multiple times, I become lost.
#include <stdio.h>
int fun(int count) {
printf("%d\n", count);
if(count < 3) {
fun(fun(fun(++count)));
}
return count;
}
int main()
{
fun(1);
return 0;
}