Chinaunix首页 | 论坛 | 博客
  • 博客访问: 345560
  • 博文数量: 135
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1106
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-20 09:56
文章分类

全部博文(135)

文章存档

2017年(3)

2016年(18)

2015年(69)

2014年(39)

2013年(6)

我的朋友

分类: C/C++

2015-10-28 16:35:23

typedef union {
    unsigned short value;
    unsigned char bytes[2];
}Test;

int main(void)
{
    Test test_vaule;
    test_vaule.value = 0x1234;

    if (test_vaule.bytes[0] == 0x12 &&
            test_vaule.bytes[1] == 0x34)
        printf ("big ending\n");
    else
        printf ("small ending\n");

    return 0;
}

阅读(432) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~