//06.12.22
//Author:Guo R.H
// USTC
//递归求最大值
#include
#include
#define N 10
int max(int a[], int n, int i)
{
int j,k;
if(i == n-1)
return j;
else
{
j = max(a, n, i+1);
return a[i]>j?a[i]:j;
}
}
int main()
{
int i, a[N];
for(i=0;i a[i] = 10-i;
a[4] = 30;
printf("%d ",max(a, N, 0));
return 0;
}
阅读(944) | 评论(0) | 转发(0) |