有关于函数和指针的编程
#include<stdio.h>刚学指针和函数,大神可以帮忙看一下错在哪里了吗
int main()
{
double fun(int a[], int n, int*max, int*min);
int n,i;
int a[1000];
int *max = a, *min = a+1;
double d;
scanf_s("%d\n", &n);
for (i = 0;i < n - 1;i++)
scanf_s("%d,",&a[i]);
scanf_s("%d", &a[n - 1]);//输入n个数
fun(a[1000], n,*max,*min);
printf("%d\n%d\n", *max, *min);//输出最大值和最小值
d = fun(a[1000], n, *max, *min);//输出均值
printf("%f",d);
}
double fun(int a[], int n, int*max, int*min)
{
int i;double z=0.000000;
for (i = 0;i < n;i++)
z = z / n + a[i] / n;//求均值
return z;
int m, j, k, t;
for (m = 0;m < n - 1;m++)
{
k = m;
for (j = m + 1;j < n;j++)
if (a[j] > a[k])k = j;
if(k!=m)
{
t = a[m];a[m] = a[k];a[k] = t;
}
}//从大到小排序
max = a;min = a + n - 1;
}