测试大小端模式

来源:互联网 发布:淘宝卖家中心 - 首页 编辑:程序博客网 时间:2024/06/10 04:28
int checkSystem( ){ union check {  int i;  char ch; }c; c.i = 1; return (c.ch ==1);}void main(){ printf("%d\n",checkSystem( ));   //如果取出低地址上的值为0 ,毫无疑问,这是大端模式;如果取出低地址上的值为1,毫无疑问,这是小端模式。}
原创粉丝点击