Which will output for example 0x0x1 for an argument value of 1. If you
were only interested in 0 values you could write simply:
printf("0x00");
I can't see anything in the standard that permits it to prepend 0x for a 0
value.
I don't see anything that forbids it. It says "For x (or X)
conversion, a nonzero result has 0x (or 0X) prefixed to it." It does
not say anything at all about a result that is not nonzero.
The # flag specifies an alterative form. It is described in terms of how
it differs from the primary form. For a 0 value there is no difference
specified. You seem to be saying that the output for a 0 value is not
specified. If that is true the output could be anything at all which would
make %#x useless for outputting 0 values.
Lawrence
To me it looks like one of those cases where the wording in the
standard leaves a loop hole. Typical standardese, as one is likely to
see if one brings up such issues on comp.std.c, is that since the
standard specifically defines behavior for the nonzero case and does
not define behavior for the 0 case, the 0 case is undefined.