代码:
#include<stdio.h>
int main()
{
int a = 0x12345678;
char* c = (char*)& a;
for (int i = 0; i < 4; i++)
printf("%d:[%p] %x\n", i, c + i, c[i]);
return 0;
}
程序运行结果:
0:[0000001F2A0FF934] 78
1:[0000001F2A0FF935] 56
2:[0000001F2A0FF936] 34
3:[0000001F2A0FF937] 12
判断:
主机为:小端序