Character and Strings
Basic In-and-Out
C program just manages the in and out program as it is managing files. So consoles like keyboard and monitor is managed like a automatical file. C program uses stdin and stdout to manage in and out, which combines into stdio.
Stream
C Program doesn't manage the file or consoles directly; they manage it using a stream, which is abstracted flow of in and out. So basically streams are virtual connections created by the OS. They need to be created and deleted by the user, except for console stream. Console streams are created automatically as program starts and deleted when its over. Standard streams are stdin, stdout, and stderr(error stream).
End of File(EOF)
End of file returns a specific value, when it reaches end of file, which is -1. UNIX system can be reached by Ctrl + D, and Windows Ctrl + Z then Enter.
Getchar() and Putchar()
Getchar() is used when we are only inputted ONE character. Putchar() is used to print out only one character that is inputted. In this example, if we input ab, then it would just give 'a' as a result.
But in this example, if we input ab, it would use ab, because this is a buffer, which temporarily recorded information. So if we input ab, the first putchar() would print 'a', then for the second putchar(), it would take out the temporarily recorded information of char ah and print the character 'b'.