初识C语言 数组名的函数传递与按键跳出
#include <stdio.h>
float a[128];
int i,s=0;
float AVG(int s,float a[s]);
float AVG(int s,float a[s])//获取了之前输入数组的元素个数和数组元素数据
{
int i=0;//定义循环次数初值
float sum=0;//定义接收数组总值的初值
for(i=0;i<s;i++)//对数组各个元素从0到结尾进行遍历累计
{
sum+=a[i];//累计数组元素
}
printf("%d个学生的平均
原创
2020-05-21 12:00:47 ·
290 阅读 ·
0 评论