这是我的主要功能..为什么我的第二个“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