阅读量:0
int main() { unsigned char array[4]={1,2,1,4}; unsigned short numA=((unsigned short)array[0]<<8) & 0xff00 | array[1];//258 unsigned short numB=((unsigned short)array[2]<<8) & 0xff00 | array[3];//260 cout<<numA<<' '<<numB<<endl; // 0000 0001 0000 0000 // 0000 0000 0000 0010 // 0000 0001 0000 0000 // 0000 0000 0000 0100 return 0; }