+ 2
What is the difference between %-8.5f and %8.5f in format specifiers in C
3 odpowiedzi
+ 12
In %a.b
a is minimum number of characters including whole part, point and decimal part
b number of characters of decimal part
If total number of characters are less than a, it fills with blank spaces at the left side of number
With - sign it fills blank spaces at the right side of the number
Example:
printf("'%8.3f'",123.45);
' 123.450'
printf("'%-8.3f'",123.45);
'123.450 '
+ 6
%8.5f is right-aligned, %-8.5f is left-aligned
0
6