#define maxlen 60
#include
typedef struct{
char name[10];
long sno;
char sex;
int age;
char *adress;
int score;
}score;
main()
{
score s1;
s1.adress=(char *)malloc(maxlen);
printf("\n input name (length<10):");
scanf("%s",s1.name);/*s1.name就是一个地址了,不需要加取地址符号.*/
printf("\n input adress(length<60):");
printf("\n input sno,sex,age,score,adress:\n");
scanf("%ld,%c,%d,%d",&s1.sno,&s1.sex,&s1.age,&s1.score);/*少了取地址符号*/
gets(s1.adress);
printf("\n name=%s,sno=%ld,sex=%c,age=%d",s1.name,s1.sno,s1.sex,s1.age);
printf("\n adress=%s,score=%d",s1.adress,s1.score);
}
同意楼上的,另外,我编译还有两处报错,是同一个问题:新类型名score 和 成员变量名score重复了。