#include <stdio.h>
int year(int n)
{
if(n==0)
{
return 0;
}
else if(n==1)
{
return 10;
}
else
{
int sum;\\这里定义过。\\
sum=(year(n-1)+2);
return sum;
}
}
int main()
{
int sum=year(5);\\这里为什么要加int,前面不是定义过吗?\\
printf("第5个人的年龄是%d岁", sum);
return 0;
}
谢谢你的回答,现在明白了,下节有讲局部与全局变量。
Indeed you difine the SUMs above twice; howeve, different SUMs remain two specific characters as well as the SUM will be output by its own