Confusion about how a getchar() loop works internally
问题 I've included an example program using getchar() below, for reference (not that anyone probably needs it), and feel free to address concerns with it if you desire. But my question is: What exactly is going on when the program calls getchar() ? Here is my understanding (please clarify or correct me): When getchar is called, it checks the STDIN buffer to see if there is any input. If there isn't any input, getchar sleeps. Upon wake, getchar checks to see if there is any input, and if not, puts