为啥ch要声明为int,而不是char

为什么ch要声明为int,而不是char?
int main()
{
char ch;

while( ( ch = getchar() ) != EOF )
putchar( ch );

}
若果说有转换的话,那个getchar()不会出问题么?
C char int

------解决方案--------------------
getchar调用成功会将读到的字符按unsigned char转为int返回。也就是说成功的话 getchar的返回值是范围是[0~255], 失败的话返回EOF(一般是-1)。
返回值类型为int而不是char是因为char(或者unsigned char)的取值范围只有256个([-128~127]或者[0~255]),无法区分正常返回的字符与EOF(-1)。

C89

4.9.7.6 The getchar function
Synopsis

#include <stdio.h> int getchar(void);
Description

The getchar function is equivalent to getc with the argument stdin. 

4.9.7.5 The getc function Synopsis

#include <stdio.h>
int getc(FILE *stream);

Description

The getc function is equivalent to fgetc, except that if it is implemented as a macro, it may evaluate stream more than once, so the argument should never be an expression with side effects.

4.9.7.1 The fgetc function
Synopsis

#include <stdio.h> int fgetc(FILE *stream);
Description

The fgetc function obtains the next character (if present) as an unsigned char converted to an int, from the input stream pointed to by stream, and advances the associated file position indicator for the stream (if defined).
Returns

The fgetc function returns the next character from the input stream pointed to by stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and fgetc returns EOF. If a read error occurs, the error indicator for the stream is set and fgetc returns EOF.112