巧用Union
来源:互联网 发布:淘宝购物货到付款流程 编辑:程序博客网 时间:2024/05/09 00:44
#include <iostream.h>
int main()
{
float f =0.1;
double d = 0.1;
union f2l{
float f;
unsigned long ul;
} fl;
union d2l{
double d;
unsigned long ull[2];
} dl;
fl.f = f;
dl.d = d;
printf("hex of float is %2X/n",f);
printf("hex of float is %2X/n",fl.ul);
printf("hex of double is %2X/n",d);
printf("hex of double is %2X %2X/n",dl.ull[1],dl.ull[0]);
}
hex of float is A0000000
hex of float is 3DCCCCCD
hex of double is 9999999A
hex of double is 3FB99999 9999999A
- 巧用Union
- Union
- union
- union
- UNION
- union
- union
- union
- UNION
- union
- union
- Union
- union
- union
- union
- union
- union
- union
- Linux 常用C函数(接口处理篇1)
- 优化entity Bean的七条准则
- Linux 常用C函数(接口处理篇2)
- XMLHTTP资料 (文摘)
- Linux 常用C函数(终端控制篇)
- 巧用Union
- 网络与系统管理
- Spring大探宝
- Linux 常用C函数(环境变量篇)
- 如何删除oracle10g中的垃圾表?(Inber原创)
- Linux 常用C函数(字符转换篇)
- 经典的导航二级式导航菜单增强版
- 使用Java中的final变量需要注意的地方。
- C++ Primer 第三篇 基于过程的程序设计