Where does `getchar()` store the user input?

后端 未结 7 2108
情深已故
情深已故 2020-12-16 04:25

I\'ve started reading \"The C Programming Language\" (K&R) and I have a doubt about the getchar() function.

For example this code:

#         


        
7条回答
  •  天涯浪人
    2020-12-16 04:55

    Your first program only reads one character, prints it out, and exits. Your second program has a loop. It keeps reading characters one at a time and printing them out until it reads an EOF character. Only one character is stored at any given time.

提交回复
热议问题