Re: printf("%#04x\n", 0); print 0000 not 0x00
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 22:58:29 -0500
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
.
- Follow-Ups:
- Re: printf("%#04x\n", 0); print 0000 not 0x00
- From: Lawrence Kirby
- Re: printf("%#04x\n", 0); print 0000 not 0x00
- References:
- printf("%#04x\n", 0); print 0000 not 0x00
- From: baumann@pan
- Re: printf("%#04x\n", 0); print 0000 not 0x00
- From: Ganesh babu
- printf("%#04x\n", 0); print 0000 not 0x00
- Prev by Date: Re: printf("%#04x\n", 0); print 0000 not 0x00
- Next by Date: Re: printf("%#04x\n", 0); print 0000 not 0x00
- Previous by thread: Re: printf("%#04x\n", 0); print 0000 not 0x00
- Next by thread: Re: printf("%#04x\n", 0); print 0000 not 0x00
- Index(es):
Relevant Pages
|