编写一个函数 求出int数组中最大的数

#include "stdAfx.h"
#include "ctype.h"
#include "stdlib.h"
int main(void)
{
	void sum_(int a[],int x);
	int a[5]={4,7,1,8,9};
	sum_(a,5);
	system("pause");
    return 0;
}
void sum_(int a[],int x)
{
	int i,sum;
	sum=a[0];
	for(i=0;i<x;i++)
		if(sum<a[i])
			sum=a[i];
	printf("%d\n",sum);
}

你可能感兴趣的:(System,include)