找不到代码中递归的结束语句,仍然能通过是为什么
#include <stdio.h>
int people(int n)
{int year;
if(n==1){
year=10;
}
else{
year=people(n-1)+2;}
return year;
}
int main()
{
int five=people(5);
printf("第5个人的年龄是%d岁", five);
return 0;
}
#include <stdio.h>
int people(int n)
{int year;
if(n==1){
year=10;
}
else{
year=people(n-1)+2;}
return year;
}
int main()
{
int five=people(5);
printf("第5个人的年龄是%d岁", five);
return 0;
}
2018-08-28
举报