How Format specifiers in C works?
If the Code is :
#include <stdio.h>
int main(void) {
// your code goes here
char *s= "First Name";
int x= 12345;
printf("%-15s%c\n", "First Name", ':');
printf("%-15s%c\n", "Last Name", ':');
printf("%-15s%c\n", "Age", ':');
printf("%10.3f\n", (float)x);
return 0;
}
then for the 3rd print statement, I get the output of :
_12345.000 (dash being a space here. )
I get it that the .3 part is controlling the precision and hence the 3 zeros, but due to the 10 its length should be 10 minimum so should get more spaces.
code is here also :https://ideone.com/Mo5jwf