一个简单的c程序,规范的函数写法
源程序:
#include <stdio.h>
void sum_data(unsigned int num,int *data,int *sum)
{
unsigned int count;
int sum_temp;
sum_temp=0;
for(count=0;count<num;count++)
{
sum_temp+=data[count];
}
*sum=sum_temp;
}
int main()
{
int number[5]={89,67,80,82,86};
int s=0;
sum_data(5,number,&s);
printf("5个整数之和为:%d\n",s);
return 1;
}