What is wrong with char c = getchar(); ?
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.