voidmain(void){ double num; printf("input a double type number: "); scanf("%f", &num); printf("the number is %f\n", num); printf("the number is %lf\n", num); }
input a double type number: 1 the number is 0.000000 the number is 0.000000
scanf()函数因为指向的是num的指针,所以不适用float promotions to double
voidmain(void){ double num; printf("input a double type number: "); scanf("%lf", &num); printf("the number is %f\n", num); printf("the number is %lf\n", num); }
input a double type number: 1 the number is 1.000000 the number is 1.000000