您现在的位置是:首页 > 其它 当前栏目 float2int 2023-09-11 14:17:25 时间 flaot转int时,会直接舍弃小数为,但是当把f所在的地址的数据当成int解析时,就是另外的情况了。 #include<iostream> using namespace std; int main() { float f= 5.2; int *p = (int*)&f; cout << (int)f << endl; cout << *p << endl; return 0; } 输出 5 1084647014 本文地址: float2int 相关文章