int checkSystem( ) { union check { int i; char ch; }c; c.i = 1; return (c.ch ==1); } void main() { printf("%d\n",checkSystem( )); //如果取出低地址上的值为0 ,毫无疑问,这是大端模式;如果取出低地址上的值为1,毫无疑问,这是小端模式。 }
测试大小端模式
最新推荐文章于 2023-07-23 22:31:48 发布
int checkSystem( ) { union check { int i; char ch; }c; c.i = 1; return (c.ch ==1); } void main() { printf("%d\n",checkSystem( )); //如果取出低地址上的值为0 ,毫无疑问,这是大端模式;如果取出低地址上的值为1,毫无疑问,这是小端模式。 }