请教各位大神:printf缓冲区刷新
windows + gcc
程序代码:
void store2(){
int n;
printf("enter max length of the word:");
scanf("%d",&n);
char t[++n];
//printf("length %d",n);
if(n>0){
printf("enter your line:");
char temp ;
int index=0;
//fflush(stdin);
for(;;){
temp=getchar();
printf("%d",temp);// temp=10, 这里的换行符是从哪里来的?
if(index == n || isspace(temp)){
t[index]='\0';
for(int i=0;i<=index;i++){
printf("%5d:%5d",index,t[index]);
}
break;
}
t[index] = temp;
index++;
}
}
fputs(t,stdout);
}







,fflush(stdin)注释掉了啊,我想问的是,这个换行符时怎么出来的,因为在scanf后,就没有刷新过缓冲区了,为什么会有这个换行符了呢,谢谢啊