在MPLAB C中将BYTE(00 - FF)转换为int(0 - 255)值 我试过这个,但它不起作用,因为我想要它:
atoi(i)
和
(i - '0')
答案 0 :(得分:2)
你可以这样做
unsigned char c = 0xF3; //there is no byte in C but unsigned char is basically equivalent
int i = c & 0xFFFF; //this will set i to the value of c;
输出
i = 243; //the decimal version of 0xF3.