The differences are as follows:
1.char accounts for 1 byte, and int accounts for 4 bytes.
2. The range of stored data is different. Char ca
The differences are as follows:
1.char accounts for 1 byte, and int accounts for 4 bytes.
2. The range of stored data is different. Char can store-128~ 127, and int can store -2 32 ~ 2 3 1- 1.
3. The stored character is the ascii code of the character, and the ascii code is 0~ 127.
4.int is an integer variable and a character is a character variable.
Extended data:
Character variables are variables that store character constants, and their values are character constants, that is, single characters. Type theory of character variables
Very charming.
2. In C language, character data and integer data can be universal, that is, a character data can be output in the form of characters or integers. When outputting in the form of characters, it is necessary to first convert the ASCII code in the storage unit into the corresponding characters, and then output. When the output is an integer, the ASCII code is directly output as an integer. Character data can also be arithmetically operated, in which case their ASCII codes are arithmetically operated. For example: ch2=ch 1+ 1.
References:
Character variables _ Baidu Encyclopedia