The #
flag has a different behavior, depending on context.
If it is used with the o
, x
, or X
specifiers, the value is preceded with 0
, 0x
, or 0X
respectively.
If it is used with a
/A
, e
/E
, f
/F
, or G
, the value always ends with a decimal point.
This behavior is quite well documented multiple places on the web. Searching for "printf" and possibly "format specifiers" will generally turn up lots of good links. Here are a few to whet your appetite: