1, representing different variable types:
Char is a character variable and int is an integer variable.
2. The application type data is different:
Char is used to apply for characters and strings or string pointers; Int is used to apply integer data or shape data pointers.
3. Bytes can represent different contents:
Char has only one byte, and int has four bytes, which can represent different content sizes; Char is only 0~255, and the range of int is [-2 3 1, 2 3 1- 1] (the processor is 64-bit, which can be larger).
Extended data:
1. When printing data defined by char and int, the data types filled in the brackets of printf ("") are "%c" and "%d" respectively.
Second, although there are differences between char data and int data, they can also be converted to each other. The specific method is as follows:
1, number of char type is converted into int type, and the conversion method is: a[i]-'0'. Reference code is as follows:
2.int type is converted into char type, and the conversion method is: a[i]+'0'. The reference code is as follows:
References:
Int- Baidu encyclopedia
Char- Baidu encyclopedia