从double到float的强制类型转换
作者:互联网
#include <stdio.h>
union FLOATUN{
unsigned int a;
float b;
};
int main(){
FLOATUN fun;
fun.b = 12.34;
printf("c:%x\n",fun.a);
double a = 12.34;
fun.b = (float) a;
printf("c:%x\n",fun.a);
}
输出结果
c:414570a4
c:414570a4
标签:类型转换,int,double,float,12.34,414570a4,fun 来源: https://blog.csdn.net/qianshishangdi/article/details/88393195