类型转化:float > DWORD

#include<iostream>
#include<windows.h>
using namespace std;


int main(void)
{
 float f = 1.1 ;
 DWORD d1 = (DWORD)f ;
 DWORD d2 = *(DWORD *)&f ;

 cout << d1 << endl ; // output: 1
 cout << d2 << endl ; // output: 1066192077

 system("pause") ;
 return 0 ;
}

作者:zdd
出处:http://www.cnblogs.com/graphics/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
原文地址:https://www.cnblogs.com/graphics/p/1654033.html