The character type in C++ is special. It is actually an 8-bit integer variable, that is, an integer in the range of -2^7~2^7-1 is stored in the same way as the int type. It represents ASCII The code is used to represent characters, but it is actually an integer, so it can be assigned to each other with other integers such as int long. However, int is 16 bits and long is 32 bits, so if you assign 100 to them both, it is OK, but if you assign 1000 to char type There will be a problem because it exceeds its value range
So in fact the character type is just an integer with a relatively small range. You can use it to perform all the operations that can be performed on integers, and can be assigned to each other with any integers. You can also output an integer variable in character format and then output the character represented by the ASCII code it represents