C语言:强制类型转换
#include <stdio.h> //强制类型转换 //写法:(类型标识符)变量;(类型标识符)常量;(类型标识符)(表达式);三种格式 main() { float a=7.5f; long b=100L; printf("%d,%d\n",sizeof(a),sizeof(b)); printf("%f,%d\n",a,b); printf("%d,%d\n",a,b); printf("%f\n",1); printf("%f\n",(1+2*2+3)); printf("%d\n",1+3/2); printf("%f\n",1/3*3); printf("%d\n",1/3*3); printf("%lf\n",132/8); printf("第%d行的结果:%lf\n",__LINE__,(float)(132)/8); printf("第%d行的结果:%f\n",__LINE__,(float)(132)/8); getchar(); }