// 小端存储的举例及联合的应用 // 小端存储即低位存在低地址处,内存里即3839 // 以short的k读出来即3839 #include <stdio.h> int main() { union { short k; char i[2]; }*s, a; s = &a; s->i[0] = 0x39; s->i[1] = 0x38; printf("%x\n", a.k); return 0; } <img src="http://img.blog.csdn.net/20150508165831368?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
时间: 2024-10-07 16:21:26