這是我的主要功能..爲什麼我的第二個「scanf」被跳過?
printf("How many marking components in the course? ");
scanf("%d", &numberOfComponents);
for (int i=0; i<numberOfComponents; i++){
char c[MAX_STR];
printf("enter next component name: ");
fgets(c, sizeof(c), stdin);
scanf(c, " %c", &c);
Component comp;
initComp(&comp, c);
class.comps[i] = comp;
}
printf("How many marking schemes? ");
scanf(" %d", &numberOfSchemes);
我已經試過白色的空間,但它仍然存在
什麼是'scanf(c,「%c」,&c);'應該是什麼意思?你用這個'scanf'調用你想要做什麼? – AnT 2014-10-17 01:07:28