1.精度格式
%【.精度】类型
2.精度作用
指定小数保留位数
float fvalue = 123.112354652;
printf("%f\n",fvalue);
printf("%f\n",fvalue);
单精度的小数,有效位数只有6-7位,超出了有效位后就是垃圾数据
有效位数是从小数点前面开始计算
双精度小数有效位数为15-16位
3.精度其他格式
printf("%.*lf\n",2,dvalue);
短整型长整型长长整形
char a = 'a';
short int b = 123;
int c = 123;
long int d = 123;
long long int e = 123;
printf("%hhi\n",a);字符型变量
printf("%hi\n",b);短整型变量
printf("%li\n",d);长整型变量
printf("%lli\n",e);长长整型变量

猜你喜欢

转载自www.cnblogs.com/-zero/p/10056430.html
今日推荐