首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

请问这个函数有什么功能

2012-02-08 
请教这个函数有什么功能char x2c(char *what){register char digitdigit (what[0] A ? ((what[0]

请教这个函数有什么功能
char x2c(char *what)
{
  register char digit;

  digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
  digit *= 16;
  digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0'));
  return(digit);
}

[解决办法]
把两位ascii字符表示的字符,如A0,转换为一个字节(其值为0xa0)

热点排行