1. String to number
If it is a single character, you can use character-'0' to convert it to a number
char a = '8';
int b = a-'0';
If it is a string, it is recommended to use the atoi function
char time[10] = "1234";
atoi(time);
2. Convert numbers to strings
char result[10]={0};
//把10进制的20转换成字符串存储早result里
itoa(20,result,10);
char time[10] = {0};
sprintf(time, "%d", 31);
If it is a single character, you can use character + '0' to convert it to a number
int b = 9;
char a = b+'0';