动态分配内存
#include<stdio.h>#include<malloc.h>
#include<stdlib.h>
int main()
{
int i,n,max,min;
double aver=0;
int *pscore;
scanf("%d",&n);
if(n<=0)
return 0;
pscore=(int*)malloc(sizeof(int)*n);
if(pscore==NULL)
exit(0);
for(i=0;i<n;i++)
scanf("%d",pscore[i]);
max=pscore[0];
min=pscore[0];
for(i=0;i<n;i++)
if(pscore[i]>max)
max=pscore[i];
if(pscore[i]<min)
min=pscore[i];
aver+=pscore[i];
printf("max=%lf min=%lf aver=%lf",max.min,aver/n);
}
求解哪里错了
报错是F:\2\main.cpp|28|error: request for member 'min' in 'max', which is of non-class type 'int'|