首页 > 其他 > 详细

判断字节序

时间:2014-06-22 23:21:52      阅读:371      评论:0      收藏:0      [点我收藏+]

大字节序(Big Endian):低地址存高位

小字节序(Little Endian):高地址存地位
int main()
{
        int x=1;
          char *temp = NULL;
          temp= (char *)&x;
        if (*temp ==1)
          {
                printf("Little endian!\n");
           }
        else             
        {
            printf("Big endian!\n");
            return 0;
          }
}
 
int型x的值为00 00 00 01
内存地址        大字节序    小字节序
0x00000001    00            01
0x00000002    00            00
0x00000003    00            00
0x00000004    01            00

判断字节序,布布扣,bubuko.com

判断字节序

原文:http://www.cnblogs.com/wanghaoran/p/3800100.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!