float用16进制输出

Posted zhengbao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了float用16进制输出相关的知识,希望对你有一定的参考价值。

 1 int main()
 2 {
 3     union{
 4         float a;
 5         unsigned b;
 6     } ha;
 7     ha.a = 2147483647;
 8     printf("%x
",ha.b);
 9     return 0;
10 } 

使用union就完事了

技术图片

 

以上是关于float用16进制输出的主要内容,如果未能解决你的问题,请参考以下文章