#include <stdio.h>
int CheckSystem()
{
union check
{
int i;
char ch;
}c;
c.i = 1;
return (c.ch == 1);
}
int main()
{
int i;
if (CheckSystem())
{
printf("小端口模式\n");
}
else
{
printf("大端口模式\n");
}
return 0;
}
大端模式,是指数据的高位,保存在内存的低地址中,而数据的低位,保存在内存的高地址中;
小端模式,是指数据的高位,保存在内存的高地址中,而数 据的低位,保存在内存的低地址中。