标签: c++ bit-manipulation
我有两个变量:
char a = "0xdb"; char b = "0x01";
如何将这些变量组合成短型?像这样:
short c = "0x01db";
感谢。
答案 0 :(得分:2)
unsigned char a = 0xdb; unsigned char b = 0x01; unsigned short c = (b << 8) | a;