printf format specification:
%[flag][width][.precision][modifier]<type>
meaning of fields with e.g.,:
format output
1. flag: printf(“%7s”,”hello”); spacespacehello
2. width: prinf(“%4d”,10); spacespace10
3. precision: (“%.2f”,1.1412); 1.41
4. modifier:
h interpreted as short used with i,d,o,u,x
l interpreted as long used with i,d,o,u,x
L interpreted as double used with i,d,o,u,x
5. type: d,i,x,X as their usual meanings etc.
i couldn’t get the flag specifier. can u elaborate it more.
@nitin sharama:
the flags :” #,0,-,+, ,’,I ”
# | Alternate
0 | zero pad,
- | left align,
+ | explicit + – sign,
| space for + sign,
‘ | locale thousands grouping
I | Use locale’s alt digits
though i can’t understand completely understand all of them….