Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Can integer variables and character variables in C language replace each other under any circumstances?
Can integer variables and character variables in C language replace each other under any circumstances?

There is basically no problem converting character type into integer type, but the other way around may cause problems. Because in C language, the integer type is generally two bytes (two for int type, 4 for long type, and one for short int type), the character type is one byte (two for unsigned type), and one byte is converted into Two are no problem, but overflow problems may occur if two are converted to one.

For example, char a=255 will overflow because the expression range of a is only -128~127