Re: printf("%#04x\n", 0); print 0000 not 0x00



On 30 Jun 2005 19:35:19 -0700, "Ganesh babu" <ganeshbabuv@xxxxxxxxx>
wrote in comp.lang.c:

> printf("0x%#02x", 0);
>
> baumann@pan wrote:
> > hi all,
> >
> > i hope
> > printf("%#04x\n", 0);
> > will output 0x00,
> > but visual c++ studio 6 outputs 0000.
> >
> > how can i get 0x00?
> >
> > thanks

....but note that the wording of the standard does not prohibit an
implementation from prepending a "0x" even if the value is 0. So on
some implementations you might get "0x0x00".

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.



Relevant Pages