小白求助 简单的递归问题
#include <iostream>
using namespace std;
int fun(int n)
{
if (n == 1)
return 6;
else
fun(n - 1);
}
int main()
{
cout << fun(10);
}
#include <iostream>
using namespace std;
int fun(int n)
{
if (n == 1)
return 6;
else
return fun(n - 1);
}
int main()
{
cout << fun(10);
}我想知道第一个程序中当n==1时,return到上层为什么还会继续返回6到上层?return 6;上层并没有return啊,怎么返回6啊?难道不是像第二个程序这样return fun(n-1)吗?
...全文


新手乐园
