Home Segments Index Top Previous Next

706: Mainline

The f specification is for reading numbers of type float. The lf specification is for reading numbers of type double.

The following program reads integers of type float and of type double:

float sample_float; 
double sample_double; 
scanf ("%f%lf", &sample_float, &sample_double); 
printf ("The float is %f; the double is %f\n", 
                      sample_float,     sample_double); 
--- Data ---
32.000 128000e+10 
--- Result --- 
The float is 32.000000; the double is 1280000000000000.000000