求大佬帮忙看一下 总是在a[]这个位置说a[i]里的i要是指针形式
#include<stdio.h>#include<string.h>
struct fruit
{
int id;
char name[20];
int height;
float weight;
}a[]={{001,"Apple",67,58},{002,"Banana”",75,70.5},{003,"Peach",65,57.5},{004,"Pineapple",60,55},{005,"Grape",80,76.5},{006,"Kiwi",78,68.9}};fruit temp;
main()
{
int i,j,a;
struct fruit *j ;
for(i=0;i<6;i++)
{
for(j=0;j<6-i-1;j++)
{
if(strlen(a[j].name<strlen(a[j+1].name)))
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
else if(strlen(a[j].name)<strlen(a[j+1].name)&&a[j].weight<a[j+1].weight)
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(a=1;a<=6;a++)
{
printf("a[a]");
}
}