int | |||
12 | 34 | 56 | 78 |
00001100 | 00100010 | 00111000 | 01001110 |
大端char | 小端char |
#include<stdio.h>
#include<stdlib.h>
int main()
{
union TestUnion
{
int a;
char b;
}tu;
tu.a= 0x12345678;
printf("%s\nb=0x%X\t a=0x%X\n",tu.b==0x12?"大端模式":"小端模式",tu.b,tu.a);
system("pause");
return 0;
}
标签:小端,int,检测,tu,模式,char,大小,0x%
From: https://www.cnblogs.com/nebula-technology/p/16705342.html