getchar函数和的putchar [英] getchar and putchar
本文介绍了getchar函数和的putchar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的C code:
INT℃;
C =的getchar();而(C!= EOF){
的putchar(C);
C =的getchar();
}
为什么这个程序是这样的反应上输入你好
?
你好
你好
和不喜欢的:
hheelloo
解决方案
您输入你好
,而不是 ^ h
电子
→
→
0
吧?
所以,你给被缓冲,直到preSS输入<大骨节病>输入骨节病>。
My C code:
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
Why does this program react like this on inputting hello
?
hello
hello
and not like:
hheelloo
解决方案
Your input is hello
and not h
e
l
l
o
right?
So the input you give is buffered until you press enter.
这篇关于getchar函数和的putchar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文