将两个unsigned short 合并成一个 unsigned int的方法.

void main() { unsigned short a[]={0xffff,0xeeee}; unsigned short *s_p=a; cout<<s_p[0]<<" "<<s_p[1]<<endl; unsigned int *p_int=(unsigned int *)s_p; cout<<*p_int<<endl;//此输出结果相当于eeeeffff }

你可能感兴趣的:(将两个unsigned short 合并成一个 unsigned int的方法.)