GetChar () function returns the problem

xiaoxiao2021-03-06  23

Consider the following code:

Char C;

C = getchar ();

IF (c == EOF)

// ...

On the machine that does not perform a symbol extension, C is always a positive number because it is a char type and EOF is negative,

The test conditions of the face will always fail. In order to avoid this, INT must be used without CHAR to save the variables of the GetChar return value.

转载请注明原文地址:https://www.9cbs.com/read-80273.html

New Post(0)