int main(int argc, const char *argv[])
{
union A
{
int a;
char b;
};
int main(int argc, const char *argv[])
{
union A u1;
u1.a = 0x12345678;
//大小端存储
if(u1.b==0x78)
{
printf("小端存储\n");
}
else if(u1.b==0x12)
{
printf("大端存储\n");
}
printf("%#x\n",u1.b);
printf("%p\n",&u1);
printf("%p\n",&(u1.a));
printf("%p\n",&(u1.b));
printf("%ld\n",sizeof(u1));
return 0;
}
网络编程day1
于 2023-09-18 21:04:17 首次发布