The maximum field width specified in the control string in the scanf() function specifies the maximum number of characters that can be read into the variable.
According to this explanation, if the input for the following code is 123.456, the output should be 123.45, but I am getting 123.4 as the output.
#include <stdio.h>
int main() {
float f;
scanf("%5f", &f);
printf("%f", f);
return 0;
}
I am unable to understand the reason for the output.