Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Can int type be cast to char type?
Can int type be cast to char type?
Int type can be cast to char type.

Char type is actually an integer, but it is an integer with the length of 1 byte.

The length of the Char type is only 1 byte, so it can represent a smaller range of values than the int type.

In fact, int type and char type can be directly assigned to each other. You can omit (char) or (int).

Char is assigned to int No problem.

Int is assigned to char, and when the value of int type exceeds the allowable range of char type, the high bit assigned to char by int will be lost.