对于结构体数组不是很熟,求解

img

img

修改如下,供参考:

#include <stdio.h>
#include <string.h>
struct ChoiceQuestion {
    int  number;
    char stem[128];
    char optionA[64];
    char optionB[64];
    char optionC[64];
    char optionD[64];
    char answer[8];
    int  score;
};
int main()
{
    struct ChoiceQuestion stu[2] = {
        {1,"题干1","A","B","C","D","答案是B",10},
        {2,"题干2","A","B","C","D","答案是C",10}
    };
    int i;
    for (i = 0; i < 2; i++) {
        printf("%d.%s(%d分)\n", stu[i].number, stu[i].stem, stu[i].score);
        printf("%s %s %s %s\n", stu[i].optionA, stu[i].optionB, stu[i].optionC, stu[i].optionD);
    }
    return 0;
}

第一个在结构体声明int类型但是在你写的结构体数组却是cha类型的,所以报错了,把"1.",改成1即可,其他的类似的改