Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is wrong with char c = getchar(); ?

char wrong
0
Posted

What is wrong with char c = getchar(); ?

0

The getchar() function returns an int, not a char. The reason for this is that getchar() needs to be able to return all possible characters that can be stored in a char, plus an additional, special constant, EOF, that indicates that an error has occurred or that an end of file (EOF) condition has been reached.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.