以下代码显示
格式为'%s',参数类型为'char *',但参数11为'int'类型
格式'%s'期望的参数类型为'char *',但是参数12的类型为'int'
我看不到变量类型有任何错误。

typedef struct{

        char country[20];
        char town[20];
    }location;
    typedef struct{
        int birthday_day;
        int birthday_month;
        int birthday_year;
    } birthday;
    typedef struct{
        char university;
        char department;
        int year_of_graduation;
    }education;
    typedef struct{
        int id;
        char name[20];
        char surname[20];
        location place;
        birthday birth;
    education school;
        int quantity_of_friends;
        int quantity_of_likes;
        int quantity_of_posts;
    }user;

user usser[100];
int i;

for (i=0;i<100;i++){
fscanf(input,"%i %s %s %s %s %i %i %i %s %s %i %i %i %i ", &usser[i].id, usser[i].name,usser[i].surname, usser[i].place.country,usser[i].place.town, &usser[i].birth.birthday_day,&usser[i].birth.birthday_month, &usser[i].birth.birthday_year, usser[i].school.university, usser[i].school.department,&usser[i].school.year_of_graduation,    &usser[i].quantity_of_friends,&usser[i].quantity_of_likes, &usser[i].quantity_of_posts);
}

最佳答案

您只声明了字符变量

    char university;
    char department;


但是您希望从中得到引起警告的字符串。

所以可能像

    char university[100];
    char department[100];

10-04 13:28