我已经看到过两种方式。这样做有什么优点或缺点吗?
short x = 0x9D6C; char cx[2]; First way: cx[0] = x &0xff; cx[1] = (x >> 8) & 0xff;
与第二种方式:
memcpy(cx, (char*)&x, 2);
有什么想法吗?