putback puts its parameter back into the input stream, making it the next character to be read. To see it at work, change your loop to the following and watch the program enter an endless loop: To see it at work, change your loop to the following and watch the program enter an endless loop: More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.