My C code:
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
Why does this program react like this on inputting
Because the default for stdin
when it refers to the keyboard is to be line buffered.
That means you only get to see full lines, and not single characters.
Imagine you ask a friend of yours what his phone number is ... but he must write it down on a piece of paper. You don't get the number digit-by-digit as he writes them: you get all of the number when he gives you the piece of paper :)