求助c语言中为什么我的代码没办法运行主函数的循环,运行到循环前面就结束了呢?

#include

struct eleve {
char *nom;
char *reponses;
};

struct eleve Tab[7] = {
{"Alain", "0011100110"},
{"Beatrice", "1001101100"},
{"Claude", "1010010100"},
{"Daniel", "0100011101"},
{"Emma",
"0111101001"},
{"Fanny", "1011101100"},
{"Gregoire", "1101101101"}
};
int Lecture(void)
{
int num;
printf("Enter a question number (from 1 to 10) :");

scanf("%d",&num);
/*if(num==0) return 0;
else if(num>0&&num<11) return num;
else Lecture();*/
if(num>10||num<0) Lecture();
else return num;
return -1;

}

void afficherEleve(struct eleve x)
{
int i=0;
int j;
for(j=0;j<10;j++)
{
if(x.reponses[j]=='1') i++;
}
printf("Name : %s, %d points\n",x.nom,i);

}
void afficherTous(void)
{
int i=0;
while(i<10)
{
afficherEleve(Tab[i]);
i++;
}

}

int nbrRep(int i)
{
int n,j;
n=0;
for(j=0;j<10;j++)
{
if(Tab[i].reponses[j]=='1') n++;
}
return n;
}

int main(int argc, char**argv) {
int NumQuest;
afficherTous();

while ((NumQuest = Lecture()!=0))
    printf("Reponses correcte s= %d\n", nbrRep(NumQuest));
return 0;

}

你的这两个结构体成员没有指明大小:
struct eleve {
char *nom;
char *reponses;
};
改为:
struct eleve {
char *nom[10};
char *reponses[15];
};
应该就可以了

https://www.cnblogs.com/Akkuman/p/6963014.html