#include <stdio.h>
int main(void) {
short i = -6566;
//char a[2];
unsigned char a[2];
a[0]=(i>>8) & 0xff;
a[1]=i & 0xff;
//short j = (a[0] << 8) | (0x00ff & a[1]);
short j = (a[0] << 8) | a[1];
printf("size = %d,i = %d\n",sizeof(i
),i
);
printf("j = %d,%d\n",j
,(unsigned short)j
);
printf("a0 = %0x,a1=%0x \n",a
[0],a
[1]);
printf("a0 = %0x,a1=%0x \n",(unsigned char)a
[0],(unsigned char)a
[1]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CgkKCXNob3J0IGkgPSAtNjU2NjsKCQoJLy9jaGFyIGFbMl07CgkKCXVuc2lnbmVkIGNoYXIgYVsyXTsKCQoJYVswXT0oaT4+OCkgJiAweGZmOwoJYVsxXT1pICYgMHhmZjsKCQoJLy9zaG9ydCBqID0gKGFbMF0gPDwgOCkgfCAoMHgwMGZmICYgYVsxXSk7CglzaG9ydCBqID0gKGFbMF0gPDwgOCkgfCBhWzFdOwoJCglwcmludGYoInNpemUgPSAlZCxpID0gJWRcbiIsc2l6ZW9mKGkpLGkpOwoJCglwcmludGYoImogPSAlZCwlZFxuIixqLCh1bnNpZ25lZCBzaG9ydClqKTsKCQoJcHJpbnRmKCJhMCA9ICUweCxhMT0lMHggXG4iLGFbMF0sYVsxXSk7CgkKCXByaW50ZigiYTAgPSAlMHgsYTE9JTB4IFxuIiwodW5zaWduZWQgY2hhcilhWzBdLCh1bnNpZ25lZCBjaGFyKWFbMV0pOwoJCglyZXR1cm4gMDsKfQo=