错误:不能将 "float *" 类型的值分配到 "float" 类型的实体

#include
#define N 15
int n;
struct plane
{ char name[50];
float height[20];};
int main(){
int k;
float avg(struct plane s[]);
void input(struct plane s[]);
printf("请输入飞机个数n(n>5)\n");
scanf("%d",&n);
struct plane s[N],*p=s;
input(p);
for(k=0;k
if(s[k].height>avg(p))
printf("%s",s[k].name);}

  return 0;}

void input(struct plane s[]){
int i;
printf("请输入战斗机型号和对应的最大飞行高度:\n");
for(i=0;i
scanf("%s %f",s[i].name,s[i].height);
}
}
float avg(struct plane s[]){
int j;float sum=0,avg;
for(j=0;j
{sum=+s[j].height;
avg=sum/n;
}
return avg;
}#include
#define N 15
int n;
struct plane
{ char name[50];
float height[20];};
int main(){
int k;
float avg(struct plane s[]);
void input(struct plane s[]);
printf("请输入飞机个数n(n>5)\n");
scanf("%d",&n);
struct plane s[N],*p=s;
input(p);
for(k=0;k
if(s[k].height>avg(p))
printf("%s",s[k].name);}

  return 0;}

void input(struct plane s[]){
int i;
printf("请输入战斗机型号和对应的最大飞行高度:\n");
for(i=0;i
scanf("%s %f",s[i].name,s[i].height);
}
}
float avg(struct plane s[]){
int j;float sum=0,avg;
for(j=0;j
{sum=+s[j].height;
avg=sum/n;
}
return avg;
}

结构体的height变量改一下,不需要定义成数组

struct plane
{
  char name[50];
  float height;
};

还有,scanf("%s %f", s[i].name, &s[i].height); 中的 s[i].height 要取地址 &

scanf("%s %f",s[i].name,&s[i].height); //浮点型要取地址

float avg(struct plane s[]){
int j;
float sum=0;
for(j=0;j<n;j++)
sum+=s[j].height;
return sum/n;
}

#include<stdio.h>
#define N 15
int n;
struct plane
{
    char name[50];
    float height;
};
int main()
{
    int k;
    float avg(struct plane s[]);
    void input(struct plane s[]);
    printf("请输入飞机个数n(n>5)\n");
    scanf("%d",&n);
    struct plane s[N],*p=s;
    input(p);
    for(k=0; k<n; k++)
    {
        if(s[k].height>avg(p))
            printf("%s",s[k].name);
    }

    return 0;
}
void input(struct plane s[])
{
    int i;
    printf("请输入战斗机型号和对应的最大飞行高度:\n");
    for(i=0; i<n; i++)
    {
        scanf("%s %f",&s[i].name,&s[i].height);
    }
}
float avg(struct plane s[])
{
    int j;
    float sum=0,avg;
    for(j=0; j<n; j++)
    {
        sum=+s[j].height;
        avg=sum/n;
    }
    return avg;
}