本文共 261 字,大约阅读时间需要 1 分钟。
Char转int:
Char与int的相互转换,联想ASCII码,字符’0’对应的值为48,所以不能直接加减’’;
Char ch = ’9’;
int ch_int = ch – ’0’; //此时ch_int = 9;
int转char:
int i= 9;
char i_ch = i + ’0’; //此时i_ch = ’9’
必须记住的几个ASCII值:
字符值ASCII值
’0’ = 48
’9’ = 57
’A’ = 65
’Z’ = 90
’a’ = 97
’z’ = 122
转载地址:http://txrxi.baihongyu.com/