getchar and putchar

后端 未结 6 1992
耶瑟儿~
耶瑟儿~ 2021-02-06 14:40

My C code:

int c;
c = getchar();

while (c != EOF) {
    putchar(c);
    c = getchar();
}

Why does this program react like this on inputting

6条回答
  •  故里飘歌
    2021-02-06 14:50

    The standard input/output streams can be buffered which means your input may not be echo'd to the screen until a whitespace character (for example) is encountered.

提交回复
热议问题