Consider the following code:
while ((c = getchar()) != EOF) // c is of char type
putchar(c);
getchar retrieves one char from the keyboard. But when I observed its execution, noticed that output of putchar does not take place until getchar encounters ENTER key. So isn't getchar actually retrieving the entire string until the ENTER key.
Actual Output:
Hello
Hello
Wanted Output:
H
H
E
E
L
L
O
O